main.dart 4.9 KB

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