main.dart 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. // ignore_for_file: must_call_super, prefer_typing_uninitialized_variables
  2. import 'package:flutter/material.dart';
  3. import 'package:go_router/go_router.dart';
  4. import 'package:namer_app/bug/addbug.dart';
  5. import 'package:namer_app/platform/addplatform.dart';
  6. import 'package:namer_app/bug/editbug.dart';
  7. import 'package:namer_app/platform/editplatform.dart';
  8. import 'package:namer_app/user/edituser.dart';
  9. import 'package:namer_app/footer.dart';
  10. import 'package:namer_app/header.dart';
  11. import 'package:namer_app/bug/listbug.dart';
  12. import 'package:namer_app/bug/listcomment.dart';
  13. import 'package:namer_app/platform/listmember.dart';
  14. import 'package:namer_app/platform/listplatform.dart';
  15. import 'package:namer_app/listtable.dart';
  16. import 'package:namer_app/user/listuser.dart';
  17. import 'package:namer_app/login.dart';
  18. import 'package:flutter/rendering.dart';
  19. import 'package:namer_app/user/signup.dart';
  20. void main() {
  21. runApp(MyApp());
  22. }
  23. // var jsonList;
  24. final _router = GoRouter(
  25. routes: [
  26. GoRoute(path: '/', builder: (context, state) => MyHomePage(), routes: [
  27. GoRoute(path: 'login', builder: (context, state) => LoginPage(), routes: [
  28. GoRoute(
  29. path: 'bug',
  30. builder: (context, state) => ListBugPage(),
  31. routes: [
  32. GoRoute(
  33. path: 'comment',
  34. builder: (context, state) => ListCommentPage(),
  35. ),
  36. GoRoute(
  37. path: 'editbug',
  38. builder: (context, state) => EditBugPage(),
  39. )
  40. ])
  41. ]),
  42. GoRoute(
  43. path: 'signup',
  44. builder: (context, state) => SignupPage(),
  45. routes: [
  46. GoRoute(
  47. path: 'listuser',
  48. builder: (context, state) => ListUserPage(),
  49. routes: [
  50. GoRoute(
  51. path: 'edit/:id',
  52. builder: (context, state) {
  53. // var item = jsonList.firstWhere(
  54. // (element) => element('id') == state.pathParameters['id']);
  55. // return EditUserPage(json: item);
  56. return EditUserPage(json: null);
  57. })
  58. ])
  59. ]),
  60. GoRoute(
  61. path: 'maintenance',
  62. builder: (context, state) => ListTablePage(),
  63. ),
  64. GoRoute(
  65. path: 'listplatform',
  66. builder: (context, state) => ListPlatformPage(),
  67. routes: [
  68. GoRoute(
  69. path: 'listmember',
  70. builder: (context, state) => ListMemberPage(),
  71. ),
  72. GoRoute(
  73. path: 'editplatform',
  74. builder: (context, state) => EditPlatformPage(),
  75. )
  76. ]),
  77. GoRoute(
  78. path: 'addbug',
  79. builder: (context, state) => AddBugPage(),
  80. ),
  81. GoRoute(
  82. path: 'addplatform',
  83. builder: (context, state) => AddPlatformPage(),
  84. ),
  85. ]),
  86. ],
  87. );
  88. class MyApp extends StatelessWidget {
  89. const MyApp({super.key});
  90. @override
  91. Widget build(BuildContext context) {
  92. return MaterialApp.router(
  93. debugShowCheckedModeBanner: false,
  94. title: 'Bug Listing',
  95. routerConfig: _router,
  96. );
  97. }
  98. }
  99. class MyHomePage extends StatelessWidget {
  100. @override
  101. Widget build(BuildContext context) {
  102. debugPaintSizeEnabled = false;
  103. return Scaffold(
  104. appBar: CustomAppbar(),
  105. body: Container(
  106. decoration: BoxDecoration(color: Colors.black.withOpacity(0.6)),
  107. child: Column(
  108. mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  109. children: [
  110. Expanded(
  111. child: Center(
  112. child: Row(
  113. mainAxisAlignment: MainAxisAlignment.center,
  114. children: [
  115. Text(
  116. 'Welcome to Bug Tracker',
  117. style: TextStyle(
  118. color: Colors.white,
  119. fontSize: 40,
  120. fontWeight: FontWeight.bold),
  121. ),
  122. ],
  123. )),
  124. ),
  125. Padding(
  126. padding: const EdgeInsets.all(8.0),
  127. child: Text(
  128. 'Track, manage, and resolve bugs efficiently',
  129. style: TextStyle(color: Colors.white, fontSize: 16),
  130. ),
  131. ),
  132. Row(
  133. mainAxisAlignment: MainAxisAlignment.center,
  134. children: [
  135. Padding(
  136. padding: const EdgeInsets.symmetric(horizontal: 10),
  137. child: ElevatedButton(
  138. onPressed: () => context.go('/signup'),
  139. style: ElevatedButton.styleFrom(
  140. side: BorderSide(color: Colors.white),
  141. backgroundColor: Colors.transparent),
  142. child: Text(
  143. 'Sign Up',
  144. style: TextStyle(color: Colors.white),
  145. ),
  146. ),
  147. ),
  148. Padding(
  149. padding: const EdgeInsets.symmetric(horizontal: 10),
  150. child: ElevatedButton(
  151. onPressed: () => context.go('/login'),
  152. style: ElevatedButton.styleFrom(
  153. backgroundColor: Colors.black,
  154. ),
  155. child: Text(
  156. 'Login',
  157. style: TextStyle(color: Colors.white),
  158. ),
  159. ),
  160. ),
  161. ],
  162. ),
  163. Expanded(child: Container())
  164. ],
  165. ),
  166. ),
  167. bottomNavigationBar: Footer());
  168. }
  169. }