main.dart 5.1 KB

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