main.dart 4.8 KB

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