main.dart 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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. title: 'TelNow Lat',
  30. theme: ThemeData(
  31. useMaterial3: true,
  32. colorScheme:
  33. ColorScheme.fromSeed(seedColor: Color.fromARGB(255, 0, 255, 255)),
  34. ),
  35. routerConfig: _router,
  36. );
  37. }
  38. }
  39. class MyHomePage extends StatelessWidget {
  40. @override
  41. Widget build(BuildContext context) {
  42. return Scaffold(
  43. //backgroundColor: Theme.of(context).colorScheme.primaryContainer,
  44. body: Container(
  45. decoration: BoxDecoration(
  46. image: DecorationImage(
  47. image: AssetImage("assets/images/building.jpg"),
  48. fit: BoxFit.cover,
  49. )),
  50. child: Column(
  51. mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  52. children: [
  53. Lang(),
  54. Expanded(
  55. child: Center(
  56. child: Text(
  57. 'telnow',
  58. style: TextStyle(color: Colors.orange, fontSize: 48),
  59. )),
  60. ),
  61. Padding(
  62. padding: const EdgeInsets.only(left: 120, right: 120),
  63. child: Text(
  64. 'Silakan pindai QR terlebih dulu untuk mulai menggunakan aplikasi.',
  65. softWrap: true,
  66. textAlign: TextAlign.center,
  67. style: TextStyle(
  68. fontSize: 16,
  69. fontWeight: FontWeight.bold,
  70. color: Colors.white),
  71. ),
  72. ),
  73. Expanded(
  74. child: Center(child: Pindai()),
  75. ),
  76. Column(
  77. children: [
  78. Text('Kebijakan Privasi',
  79. style: TextStyle(
  80. fontSize: 16,
  81. decoration: TextDecoration.underline,
  82. fontWeight: FontWeight.w800,
  83. color: Colors.white)),
  84. Text('Versi 4.0.0.0',
  85. style: TextStyle(
  86. fontSize: 16,
  87. fontWeight: FontWeight.w800,
  88. color: Colors.white,
  89. ))
  90. ],
  91. ),
  92. Container(
  93. color: Theme.of(context).colorScheme.primaryContainer,
  94. )
  95. ],
  96. ),
  97. ),
  98. );
  99. }
  100. }
  101. class Pindai extends StatelessWidget {
  102. const Pindai({
  103. Key? key,
  104. }) : super(key: key);
  105. @override
  106. Widget build(BuildContext context) {
  107. return ElevatedButton(
  108. onPressed: () => context.go('/login'),
  109. style: ButtonStyle(
  110. padding: MaterialStateProperty.all<EdgeInsets>(EdgeInsets.all(50)),
  111. foregroundColor: MaterialStateProperty.all<Color>(Colors.black),
  112. backgroundColor:
  113. MaterialStateProperty.all(Color.fromARGB(1, 7, 140, 132)),
  114. shape: MaterialStateProperty.all<RoundedRectangleBorder>(
  115. RoundedRectangleBorder(
  116. borderRadius: BorderRadius.circular(18.0),
  117. ))),
  118. child: Text(
  119. 'Pindai QR',
  120. style: TextStyle(color: Colors.white),
  121. ),
  122. );
  123. }
  124. }