main.dart 5.5 KB

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