main.dart 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. import 'package:flutter/material.dart';
  2. import 'package:go_router/go_router.dart';
  3. import 'package:namer_app/login.dart';
  4. void main() {
  5. runApp(MyApp());
  6. }
  7. final _router = GoRouter(
  8. routes: [
  9. GoRoute(
  10. path: '/',
  11. builder: (context, state) => MyHomePage(),
  12. routes: [
  13. GoRoute(
  14. path: '/login',
  15. builder: (context, state) => const Login(),)
  16. ]
  17. ),
  18. ],
  19. );
  20. class MyApp extends StatelessWidget {
  21. const MyApp({super.key});
  22. @override
  23. Widget build(BuildContext context) {
  24. return MaterialApp.router(
  25. title: 'TelNow Lat',
  26. theme: ThemeData(
  27. useMaterial3: true,
  28. colorScheme: ColorScheme.fromSeed(seedColor: Color.fromARGB(255, 0, 255, 255)),
  29. ),
  30. // home: MyHomePage(),
  31. routerConfig: _router,
  32. );
  33. }
  34. }
  35. class MyHomePage extends StatelessWidget {
  36. @override
  37. Widget build(BuildContext context) {
  38. return Scaffold(
  39. backgroundColor: Theme.of(context).colorScheme.primaryContainer,
  40. body: Column(
  41. mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  42. children: [
  43. Lang(),
  44. Expanded(
  45. child: Center(
  46. child: Text('TelNow',
  47. style: TextStyle(color: Colors.orange,
  48. fontSize: 48),
  49. )
  50. ),
  51. ),
  52. Padding(
  53. padding: const EdgeInsets.only(left: 120, right: 120),
  54. child: Text('Silakan pindai QR terlebih dulu untuk mulai menggunakan aplikasi.',
  55. softWrap: true,
  56. textAlign: TextAlign.center,
  57. ),
  58. ),
  59. Expanded(child:
  60. Center(child: Pindai()),
  61. ),
  62. Text('Kebijakan Privasi'),
  63. Text('Versi 4.0.0.0'),
  64. Container(
  65. color: Theme.of(context).colorScheme.primaryContainer,
  66. )
  67. ],
  68. ),
  69. );
  70. }
  71. }
  72. class Lang extends StatefulWidget {
  73. const Lang({
  74. Key? key,
  75. }) : super(key: key);
  76. @override
  77. State<Lang> createState() => _LangState();
  78. }
  79. class _LangState extends State<Lang> {
  80. var selectedIndex = 0;
  81. @override
  82. Widget build(BuildContext context) {
  83. return Padding(
  84. padding: const EdgeInsets.all(8.0),
  85. child: Row(
  86. children: [
  87. Expanded(child: Container()),
  88. ElevatedButton
  89. (onPressed: (){print('EN');},
  90. style: ButtonStyle(
  91. foregroundColor: MaterialStateProperty.all<Color>(Colors.white),
  92. backgroundColor: MaterialStateProperty.all<Color>(Colors.white70),
  93. shape: MaterialStateProperty.all<RoundedRectangleBorder>(
  94. RoundedRectangleBorder(
  95. borderRadius: BorderRadius.only(topLeft: Radius.circular(20), bottomLeft: Radius.circular(20)),
  96. //side: BorderSide(color: Colors.red),
  97. )
  98. )
  99. ),
  100. child: Text('EN'),
  101. ),
  102. ElevatedButton
  103. (onPressed: (){print('ID');},
  104. style: ButtonStyle(
  105. foregroundColor: MaterialStateProperty.all<Color>(Colors.white),
  106. backgroundColor: MaterialStateProperty.all<Color>(Colors.red),
  107. shape: MaterialStateProperty.all<RoundedRectangleBorder>(
  108. RoundedRectangleBorder(
  109. borderRadius: BorderRadius.only(topRight: Radius.circular(20), bottomRight: Radius.circular(20)),
  110. side: BorderSide(color: Colors.red),
  111. )
  112. )
  113. ),
  114. child: Text('ID'))
  115. ],
  116. ),
  117. );
  118. }
  119. }
  120. // class Judul extends StatelessWidget {
  121. // const Judul({
  122. // Key? key,
  123. // }) : super(key: key);
  124. // @override
  125. // Widget build(BuildContext context) {
  126. // var theme = Theme.of(context);
  127. // var style = theme.textTheme.displayMedium!.copyWith(
  128. // color: Colors.orange,
  129. // );
  130. // return Column(
  131. // children: [
  132. // Text('TelNow', style: style),
  133. // ],
  134. // );
  135. // }
  136. // }
  137. class Pindai extends StatelessWidget {
  138. const Pindai({
  139. Key? key,
  140. }) : super(key: key);
  141. @override
  142. Widget build(BuildContext context) {
  143. return Expanded(
  144. child: Center(
  145. child: ElevatedButton(
  146. onPressed: () => context.go('/login'),
  147. style: ButtonStyle(
  148. padding: MaterialStateProperty.all<EdgeInsets>(EdgeInsets.all(50)),
  149. foregroundColor: MaterialStateProperty.all<Color>(Colors.black),
  150. shape: MaterialStateProperty.all<RoundedRectangleBorder>(
  151. RoundedRectangleBorder(
  152. borderRadius: BorderRadius.circular(18.0),
  153. )
  154. )
  155. ),
  156. child: Text('Pindai QR'),)
  157. ),
  158. );
  159. }
  160. }
  161. // class Footer extends StatelessWidget {
  162. // const Footer({
  163. // Key? key,
  164. // }) : super(key: key);
  165. // @override
  166. // Widget build(BuildContext context) {
  167. // return Column(
  168. // children: [
  169. // Text('Kebijakan Privasi'),
  170. // Text('Versi 4.0.0.0'),
  171. // ],
  172. // );
  173. // }
  174. // }
  175. // class Login extends StatelessWidget {
  176. // /// Constructs a [DetailsScreen]
  177. // const Login({Key? key}) : super(key: key);
  178. // @override
  179. // Widget build(BuildContext context) {
  180. // return Scaffold(
  181. // appBar: AppBar(title: const Text('Details Screen')),
  182. // body: Center(
  183. // child: Column(
  184. // mainAxisAlignment: MainAxisAlignment.center,
  185. // children: <ElevatedButton>[
  186. // ElevatedButton(
  187. // onPressed: () {print('x');},
  188. // child: const Text('Go back to the Home screen'),
  189. // ),
  190. // ],
  191. // ),
  192. // ),
  193. // );
  194. // }
  195. // }