main.dart 5.5 KB

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