123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221 |
- // ignore_for_file: must_call_super, prefer_typing_uninitialized_variables
- import 'package:flutter/material.dart';
- import 'package:go_router/go_router.dart';
- import 'package:namer_app/bug/addbug.dart';
- import 'package:namer_app/platform/addplatform.dart';
- import 'package:namer_app/bug/editbug.dart';
- import 'package:namer_app/platform/editplatform.dart';
- import 'package:namer_app/project/addmember.dart';
- import 'package:namer_app/project/addproject.dart';
- import 'package:namer_app/project/editproject.dart';
- import 'package:namer_app/project/listproject.dart';
- import 'package:namer_app/user/chgpass.dart';
- import 'package:namer_app/user/edituser.dart';
- import 'package:namer_app/footer.dart';
- import 'package:namer_app/header.dart';
- import 'package:namer_app/bug/listbug.dart';
- import 'package:namer_app/bug/listcomment.dart';
- import 'package:namer_app/project/listmember.dart';
- import 'package:namer_app/platform/listplatform.dart';
- import 'package:namer_app/listtable.dart';
- import 'package:namer_app/user/listuser.dart';
- import 'package:namer_app/login.dart';
- import 'package:flutter/rendering.dart';
- import 'package:namer_app/user/signup.dart';
- import 'bug/addcomment.dart';
- void main() {
-
- runApp(MyApp());
- }
- // @override
- // void initState(){
-
- // getData();
- // }
- // var jsonList;
- // void getData() async {
- // try {
- // var response = await Dio()
- // .get('http://localhost:8080/api/v1/projects',
- // options: Options(headers: headers));
- // if (response.statusCode == 200) {
- // setState(() {
- // jsonList = response.data['results'] as List;
- // });
- // } else {
- // print(response.statusCode);
- // }
- // } catch (e) {
- // print(e);
- // }
- // }
- // var jsonList;
- final _router = GoRouter(
- routes: [
- GoRoute(path: '/', builder: (context, state) => MyHomePage(), routes: [
- GoRoute(path: 'login', builder: (context, state) => LoginPage(), routes: [
- GoRoute(
- path: 'bug',
- builder: (context, state) => ListBugPage(),
- routes: [
- GoRoute(
- path: 'comment',
- builder: (context, state) => ListCommentPage(bugId: 1,),
- ),
- GoRoute(
- path: 'editbug',
- builder: (context, state) => EditBugPage(),
- )
- ])
- ]),
- GoRoute(
- path: 'signup',
- builder: (context, state) => SignupPage(),
- routes: [
- GoRoute(
- path: 'listuser',
- builder: (context, state) => ListUserPage(),
- routes: [
- GoRoute(
- path: 'edit/:id',
- builder: (context, state) {
- // var item = jsonList.firstWhere(
- // (element) => element('id') == state.pathParameters['id']);
- return EditUserPage(id: state.pathParameters['id']);
- // return EditUserPage(json: null);
- })
- ])
- ]),
- GoRoute(
- path: 'maintenance',
- builder: (context, state) => ListTablePage(),
- ),
- GoRoute(
- path: 'listplatform',
- builder: (context, state) => ListPlatformPage(),
- routes: [
- GoRoute(
- path: 'listmember',
- builder: (context, state) => ListMemberPage(projId: 1,),
- ),
- GoRoute(
- path: 'editplatform',
- builder: (context, state) => EditPlatformPage(),
- )
- ]),
- GoRoute(
- path: 'addbug',
- builder: (context, state) => AddBugPage(),
- ),
- GoRoute(
- path: 'addplatform',
- builder: (context, state) => AddPlatformPage(),
- ),
- GoRoute(path: 'listproject',
- builder: (context, state) => ListProjectPage(),
- ),
- GoRoute(path: 'addproject',
- builder: (context, state) => AddProjectPage(),
- ),
- GoRoute(path: 'editproject',
- builder: (context, state) => EditProjectPage(),
- ),
- GoRoute(path: 'addmember',
- builder: (context, state) => AddMemberPage(projId: 1),
- ),
- GoRoute(path: 'changepass',
- builder: (context, state) => ChangepassPage(), ),
- GoRoute(path: 'addcomment',
- builder: (context, state) => AddCommentPage(bugId: 1),),
- ]),
- ],
- );
- class MyApp extends StatelessWidget {
- const MyApp({super.key});
- @override
- Widget build(BuildContext context) {
- return MaterialApp.router(
- debugShowCheckedModeBanner: false,
- title: 'Bug Listing',
- routerConfig: _router,
- );
- }
- }
- class MyHomePage extends StatelessWidget {
- @override
- Widget build(BuildContext context) {
- debugPaintSizeEnabled = false;
- return Scaffold(
- appBar: CustomAppbar(),
- body: Container(
- decoration: BoxDecoration(color: Colors.black.withOpacity(0.6)),
- child: Column(
- mainAxisAlignment: MainAxisAlignment.spaceEvenly,
- children: [
- Expanded(
- child: Center(
- child: Row(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- Text(
- 'Welcome to Bug Tracker',
- style: TextStyle(
- color: Colors.white,
- fontSize: 40,
- fontWeight: FontWeight.bold),
- ),
- ],
- )),
- ),
- Padding(
- padding: const EdgeInsets.all(8.0),
- child: Text(
- 'Track, manage, and resolve bugs efficiently',
- style: TextStyle(color: Colors.white, fontSize: 16),
- ),
- ),
- Row(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- Padding(
- padding: const EdgeInsets.symmetric(horizontal: 10),
- child: ElevatedButton(
- onPressed: () => context.go('/signup'),
- style: ElevatedButton.styleFrom(
- side: BorderSide(color: Colors.white),
- backgroundColor: Colors.transparent),
- child: Text(
- 'Sign Up',
- style: TextStyle(color: Colors.white),
- ),
- ),
- ),
- Padding(
- padding: const EdgeInsets.symmetric(horizontal: 10),
- child: ElevatedButton(
- onPressed: () => context.go('/login'),
- style: ElevatedButton.styleFrom(
- backgroundColor: Colors.black,
- ),
- child: Text(
- 'Login',
- style: TextStyle(color: Colors.white),
- ),
- ),
- ),
- ],
- ),
- Expanded(child: Container())
- ],
- ),
- ),
- bottomNavigationBar: Footer());
- }
- }
|