main.dart 5.7 KB

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