main.dart 4.9 KB

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