main.dart 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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. color: Colors.white)),
  105. Text('Versi 4.0.0.0',
  106. style: TextStyle(
  107. fontSize: 16,
  108. fontWeight: FontWeight.w400,
  109. color: Colors.white,
  110. ))
  111. ],
  112. ),
  113. ),
  114. ],
  115. ),
  116. ),
  117. );
  118. }
  119. }
  120. class Pindai extends StatelessWidget {
  121. const Pindai({
  122. Key? key,
  123. }) : super(key: key);
  124. @override
  125. Widget build(BuildContext context) {
  126. return SizedBox(
  127. width: 257,
  128. height: 96,
  129. child: ElevatedButton(
  130. onPressed: () => context.go('/login'),
  131. style: ElevatedButton.styleFrom(
  132. backgroundColor: Color(0xff078C84).withOpacity(0.76),
  133. side: BorderSide(color: Colors.white),
  134. shape: RoundedRectangleBorder(
  135. borderRadius: BorderRadius.circular(12.0),
  136. ),
  137. ),
  138. child: Row(
  139. mainAxisAlignment: MainAxisAlignment.center,
  140. children: [
  141. Text(
  142. 'Pindai QR',
  143. style: TextStyle(color: Colors.white, fontSize: 20),
  144. ),
  145. Image.asset(
  146. 'assets/images/scan_icon_183865.png',
  147. width: 32,
  148. height: 32,
  149. fit: BoxFit.cover,
  150. color: Color(0xffFFFFFF),
  151. )
  152. ],
  153. ),
  154. ));
  155. }
  156. }