main.dart 5.2 KB

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