main.dart 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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. }
  9. final _router = GoRouter(
  10. routes: [
  11. GoRoute(path: '/', builder: (context, state) => MyHomePage(), //),
  12. routes: [
  13. GoRoute(
  14. path: 'login',
  15. builder: (context, state) => LoginPage(),
  16. ),
  17. GoRoute(
  18. path: 'list',
  19. builder: (context, state) => ListPage(),
  20. ),
  21. ]),
  22. ],
  23. );
  24. class MyApp extends StatelessWidget {
  25. const MyApp({super.key});
  26. @override
  27. Widget build(BuildContext context) {
  28. return MaterialApp.router(
  29. debugShowCheckedModeBanner: false,
  30. title: 'TelNow Lat',
  31. theme: ThemeData(
  32. useMaterial3: true,
  33. // colorScheme:
  34. // ColorScheme.fromSeed(seedColor: Color(0xffD9D9D1)),
  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(0xffD9D9D1),
  51. Color(0xff968E73),
  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: Text(
  70. 'telnow',
  71. style: TextStyle(color: Color(0xffFF6600), fontSize: 48),
  72. )),
  73. ),
  74. Padding(
  75. padding: const EdgeInsets.only(left: 120, right: 120),
  76. child: Text(
  77. 'Silakan pindai QR terlebih dulu untuk mulai menggunakan aplikasi.',
  78. softWrap: true,
  79. textAlign: TextAlign.center,
  80. style: TextStyle(
  81. fontSize: 16,
  82. fontWeight: FontWeight.bold,
  83. color: Colors.white),
  84. ),
  85. ),
  86. Expanded(
  87. child: Center(child: Pindai()),
  88. ),
  89. Column(
  90. children: [
  91. Text('Kebijakan Privasi',
  92. style: TextStyle(
  93. fontSize: 16,
  94. decoration: TextDecoration.underline,
  95. fontWeight: FontWeight.w800,
  96. color: Colors.white)),
  97. Text('Versi 4.0.0.0',
  98. style: TextStyle(
  99. fontSize: 16,
  100. fontWeight: FontWeight.w800,
  101. color: Colors.white,
  102. ))
  103. ],
  104. ),
  105. Container(
  106. color: Theme.of(context).colorScheme.primaryContainer,
  107. )
  108. ],
  109. ),
  110. ),
  111. );
  112. }
  113. }
  114. class Pindai extends StatelessWidget {
  115. const Pindai({
  116. Key? key,
  117. }) : super(key: key);
  118. @override
  119. Widget build(BuildContext context) {
  120. return ElevatedButton(
  121. onPressed: () => context.go('/login'),
  122. style: ButtonStyle(
  123. padding: MaterialStateProperty.all<EdgeInsets>(EdgeInsets.all(50)),
  124. foregroundColor: MaterialStateProperty.all<Color>(Colors.black),
  125. backgroundColor:
  126. MaterialStateProperty.all(Color.fromARGB(1, 7, 140, 132)),
  127. shape: MaterialStateProperty.all<RoundedRectangleBorder>(
  128. RoundedRectangleBorder(
  129. borderRadius: BorderRadius.circular(18.0),
  130. ))),
  131. child: Text(
  132. 'Pindai QR',
  133. style: TextStyle(color: Colors.white),
  134. ),
  135. );
  136. }
  137. }