main.dart 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. import 'package:flutter/material.dart';
  2. import 'package:go_router/go_router.dart';
  3. import 'package:namer_app/account.dart';
  4. import 'package:namer_app/data.dart';
  5. import 'package:namer_app/list.dart';
  6. import 'package:namer_app/login.dart';
  7. import 'package:namer_app/lang.dart';
  8. import 'package:namer_app/listblock.dart';
  9. import 'package:flutter/rendering.dart';
  10. import 'package:namer_app/detail.dart';
  11. import 'package:namer_app/search.dart';
  12. void main() {
  13. runApp(MyApp());
  14. }
  15. final _router = GoRouter(
  16. routes: [
  17. GoRoute(path: '/', builder: (context, state) => MyHomePage(), routes: [
  18. GoRoute(
  19. path: 'login',
  20. builder: (context, state) => LoginPage(),
  21. ),
  22. GoRoute(
  23. path: 'list',
  24. builder: (context, state) => ListPage(),
  25. routes: [
  26. GoRoute(
  27. path: 'listblock',
  28. builder: (context, state) => ListBlockPage(),
  29. routes: [
  30. GoRoute(
  31. path: 'search/:type',
  32. builder: (context, state) {
  33. var item = items.firstWhere(
  34. (element) => element['type'] == state.pathParameters['type']);
  35. return SearchPage(items: item);
  36. })
  37. ],
  38. ),
  39. GoRoute(
  40. path: 'detail/:type',
  41. builder: (context, state) {
  42. var item = items.firstWhere(
  43. (element) => element['type'] == state.pathParameters['type']);
  44. return DetailPage(items: item);
  45. })
  46. ],
  47. ),
  48. GoRoute(
  49. path: 'account',
  50. builder: (context, state) => AccountPage(),
  51. ),
  52. ]),
  53. ],
  54. );
  55. class MyApp extends StatelessWidget {
  56. const MyApp({super.key});
  57. @override
  58. Widget build(BuildContext context) {
  59. return MaterialApp.router(
  60. debugShowCheckedModeBanner: false,
  61. title: 'TelNow Lat',
  62. routerConfig: _router,
  63. );
  64. }
  65. }
  66. class MyHomePage extends StatelessWidget {
  67. @override
  68. Widget build(BuildContext context) {
  69. debugPaintSizeEnabled = false;
  70. return Scaffold(
  71. body: Container(
  72. decoration: BoxDecoration(
  73. gradient: LinearGradient(
  74. begin: Alignment.topCenter,
  75. end: Alignment.bottomCenter,
  76. colors: [
  77. Color(0xffD9D9D9),
  78. Color(0xff0F968E),
  79. Color(0xff000000)
  80. ]),
  81. image: DecorationImage(
  82. image: AssetImage("assets/images/building.jpg"),
  83. fit: BoxFit.cover,
  84. )),
  85. child: Column(
  86. mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  87. children: [
  88. Row(
  89. mainAxisAlignment: MainAxisAlignment.end,
  90. children: [
  91. Lang(),
  92. ],
  93. ),
  94. Expanded(
  95. child: Center(
  96. child: Row(
  97. mainAxisAlignment: MainAxisAlignment.center,
  98. children: [
  99. Text(
  100. 'tel',
  101. style: TextStyle(color: Color(0xffFF6600), fontSize: 48),
  102. ),
  103. Text(
  104. 'now',
  105. style: TextStyle(color: Color(0xffFFFFFF), fontSize: 48),
  106. ),
  107. ],
  108. )),
  109. ),
  110. Padding(
  111. padding: const EdgeInsets.only(left: 180, right: 180),
  112. child: Text(
  113. 'Silakan pindai QR terlebih dulu untuk mulai menggunakan aplikasi.',
  114. softWrap: true,
  115. textAlign: TextAlign.center,
  116. style: TextStyle(fontSize: 16, color: Colors.white),
  117. ),
  118. ),
  119. Expanded(
  120. child: Center(child: Pindai()),
  121. ),
  122. Padding(
  123. padding: const EdgeInsets.all(8.0),
  124. child: Column(
  125. children: [
  126. Text('Kebijakan Privasi',
  127. style: TextStyle(
  128. fontSize: 16,
  129. decoration: TextDecoration.underline,
  130. fontWeight: FontWeight.w400,
  131. decorationColor: Colors.white,
  132. color: Colors.white)),
  133. Text('Versi 4.0.0.0',
  134. style: TextStyle(
  135. fontSize: 16,
  136. fontWeight: FontWeight.w400,
  137. color: Colors.white,
  138. ))
  139. ],
  140. ),
  141. ),
  142. ],
  143. ),
  144. ),
  145. );
  146. }
  147. }
  148. class Pindai extends StatelessWidget {
  149. const Pindai({
  150. Key? key,
  151. }) : super(key: key);
  152. @override
  153. Widget build(BuildContext context) {
  154. return SizedBox(
  155. width: 257,
  156. height: 96,
  157. child: ElevatedButton(
  158. onPressed: () => context.go('/login'),
  159. style: ElevatedButton.styleFrom(
  160. backgroundColor: Color(0xff078C84).withOpacity(0.76),
  161. side: BorderSide(color: Colors.white),
  162. shape: RoundedRectangleBorder(
  163. borderRadius: BorderRadius.circular(12.0),
  164. ),
  165. ),
  166. child: Row(
  167. mainAxisAlignment: MainAxisAlignment.center,
  168. children: [
  169. Text(
  170. 'Pindai QR',
  171. style: TextStyle(color: Colors.white, fontSize: 20),
  172. ),
  173. Container(
  174. width: 5,
  175. ),
  176. Image.asset(
  177. 'assets/images/scan_icon_183865.png',
  178. width: 32,
  179. height: 32,
  180. fit: BoxFit.cover,
  181. color: Color(0xffFFFFFF),
  182. )
  183. ],
  184. ),
  185. ));
  186. }
  187. }