main.dart 4.7 KB

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