main.dart 3.6 KB

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