main.dart 4.6 KB

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