|
@@ -0,0 +1,443 @@
|
|
|
|
+import 'package:dropdown_button2/dropdown_button2.dart';
|
|
|
|
+import 'package:flutter/material.dart';
|
|
|
|
+import 'package:go_router/go_router.dart';
|
|
|
|
+
|
|
|
|
+class CustomAppbar extends StatefulWidget implements PreferredSizeWidget {
|
|
|
|
+ final bool? isBack;
|
|
|
|
+ final TextEditingController? controller;
|
|
|
|
+
|
|
|
|
+ const CustomAppbar({super.key, this.isBack, this.controller});
|
|
|
|
+
|
|
|
|
+ @override
|
|
|
|
+ State<CustomAppbar> createState() => _CustomAppbarState();
|
|
|
|
+
|
|
|
|
+ @override
|
|
|
|
+ Size get preferredSize => Size(15, 50);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+class _CustomAppbarState extends State<CustomAppbar> {
|
|
|
|
+ @override
|
|
|
|
+ Widget build(BuildContext context) {
|
|
|
|
+ return AppBar(
|
|
|
|
+ backgroundColor: Colors.white,
|
|
|
|
+ leading: Icon(Icons.bug_report),
|
|
|
|
+ titleSpacing: 0,
|
|
|
|
+ title: Text(
|
|
|
|
+ 'Bug Listing',
|
|
|
|
+ style: TextStyle(fontSize: 28, fontWeight: FontWeight.w500),
|
|
|
|
+ ),
|
|
|
|
+ actions: [
|
|
|
|
+ Padding(
|
|
|
|
+ padding: const EdgeInsets.symmetric(horizontal: 8.0),
|
|
|
|
+ child: DropdownButtonHideUnderline(
|
|
|
|
+ child: DropdownButton2(
|
|
|
|
+ customButton: const Icon(Icons.home),
|
|
|
|
+ onChanged: (value) => context.go('/'),
|
|
|
|
+ items: [
|
|
|
|
+ DropdownMenuItem(
|
|
|
|
+ child: Text('Home'),
|
|
|
|
+ )
|
|
|
|
+ ],
|
|
|
|
+ dropdownStyleData: DropdownStyleData(
|
|
|
|
+ width: 80,
|
|
|
|
+ padding: const EdgeInsets.symmetric(vertical: 6),
|
|
|
|
+ decoration: BoxDecoration(
|
|
|
|
+ borderRadius: BorderRadius.circular(4),
|
|
|
|
+ ),
|
|
|
|
+ offset: const Offset(0, 8),
|
|
|
|
+ ),
|
|
|
|
+ ),
|
|
|
|
+ ),
|
|
|
|
+ ),
|
|
|
|
+ Padding(
|
|
|
|
+ padding: const EdgeInsets.symmetric(horizontal: 8.0),
|
|
|
|
+ child: DropdownButtonHideUnderline(
|
|
|
|
+ child: DropdownButton2(
|
|
|
|
+ customButton: const Icon(Icons.person),
|
|
|
|
+ items: [
|
|
|
|
+ ...UserItems.firstItems.map(
|
|
|
|
+ (item) => DropdownMenuItem<MenuItem>(
|
|
|
|
+ value: item,
|
|
|
|
+ child: UserItems.buildItem(item),
|
|
|
|
+ ),
|
|
|
|
+ ),
|
|
|
|
+ ],
|
|
|
|
+ onChanged: (value) {
|
|
|
|
+ UserItems.onChanged(context, value!);
|
|
|
|
+ },
|
|
|
|
+ dropdownStyleData: DropdownStyleData(
|
|
|
|
+ width: 100,
|
|
|
|
+ padding: const EdgeInsets.symmetric(vertical: 6),
|
|
|
|
+ decoration: BoxDecoration(
|
|
|
|
+ borderRadius: BorderRadius.circular(4),
|
|
|
|
+ ),
|
|
|
|
+ offset: const Offset(0, 8),
|
|
|
|
+ ),
|
|
|
|
+ menuItemStyleData: MenuItemStyleData(
|
|
|
|
+ customHeights: [
|
|
|
|
+ ...List<double>.filled(UserItems.firstItems.length, 48),
|
|
|
|
+ ],
|
|
|
|
+ padding: const EdgeInsets.only(left: 16, right: 16),
|
|
|
|
+ ),
|
|
|
|
+ ),
|
|
|
|
+ ),
|
|
|
|
+ ),
|
|
|
|
+ Padding(
|
|
|
|
+ padding: const EdgeInsets.symmetric(horizontal: 8.0),
|
|
|
|
+ child: DropdownButtonHideUnderline(
|
|
|
|
+ child: DropdownButton2(
|
|
|
|
+ customButton: const Icon(Icons.bug_report),
|
|
|
|
+ items: [
|
|
|
|
+ ...BugItems.firstItems.map(
|
|
|
|
+ (item) => DropdownMenuItem<MenuItem>(
|
|
|
|
+ value: item,
|
|
|
|
+ child: BugItems.buildItem(item),
|
|
|
|
+ ),
|
|
|
|
+ ),
|
|
|
|
+ ],
|
|
|
|
+ onChanged: (value) {
|
|
|
|
+ BugItems.onChanged(context, value!);
|
|
|
|
+ },
|
|
|
|
+ dropdownStyleData: DropdownStyleData(
|
|
|
|
+ width: 120,
|
|
|
|
+ padding: const EdgeInsets.symmetric(vertical: 6),
|
|
|
|
+ decoration: BoxDecoration(
|
|
|
|
+ borderRadius: BorderRadius.circular(4),
|
|
|
|
+ ),
|
|
|
|
+ offset: const Offset(0, 8),
|
|
|
|
+ ),
|
|
|
|
+ menuItemStyleData: MenuItemStyleData(
|
|
|
|
+ customHeights: [
|
|
|
|
+ ...List<double>.filled(BugItems.firstItems.length, 48),
|
|
|
|
+ ],
|
|
|
|
+ padding: const EdgeInsets.only(left: 16, right: 16),
|
|
|
|
+ ),
|
|
|
|
+ ),
|
|
|
|
+ ),
|
|
|
|
+ ),
|
|
|
|
+ Padding(
|
|
|
|
+ padding: const EdgeInsets.symmetric(horizontal: 8.0),
|
|
|
|
+ child: DropdownButtonHideUnderline(
|
|
|
|
+ child: DropdownButton2(
|
|
|
|
+ customButton: const Icon(Icons.build),
|
|
|
|
+ items: [
|
|
|
|
+ ...ProjectItems.firstItems.map(
|
|
|
|
+ (item) => DropdownMenuItem<MenuItem>(
|
|
|
|
+ value: item,
|
|
|
|
+ child: ProjectItems.buildItem(item),
|
|
|
|
+ ),
|
|
|
|
+ ),
|
|
|
|
+ ],
|
|
|
|
+ onChanged: (value) {
|
|
|
|
+ ProjectItems.onChanged(context, value!);
|
|
|
|
+ },
|
|
|
|
+ dropdownStyleData: DropdownStyleData(
|
|
|
|
+ width: 150,
|
|
|
|
+ padding: const EdgeInsets.symmetric(vertical: 6),
|
|
|
|
+ decoration: BoxDecoration(
|
|
|
|
+ borderRadius: BorderRadius.circular(4),
|
|
|
|
+ ),
|
|
|
|
+ offset: const Offset(0, 8),
|
|
|
|
+ ),
|
|
|
|
+ menuItemStyleData: MenuItemStyleData(
|
|
|
|
+ customHeights: [
|
|
|
|
+ ...List<double>.filled(ProjectItems.firstItems.length, 48),
|
|
|
|
+ ],
|
|
|
|
+ padding: const EdgeInsets.only(left: 16, right: 16),
|
|
|
|
+ ),
|
|
|
|
+ ),
|
|
|
|
+ ),
|
|
|
|
+ ),
|
|
|
|
+ Padding(
|
|
|
|
+ padding: const EdgeInsets.symmetric(horizontal: 8.0),
|
|
|
|
+ child: DropdownButtonHideUnderline(
|
|
|
|
+ child: DropdownButton2(
|
|
|
|
+ customButton: const Icon(Icons.dynamic_form),
|
|
|
|
+ items: [
|
|
|
|
+ ...PlatformItems.firstItems.map(
|
|
|
|
+ (item) => DropdownMenuItem<MenuItem>(
|
|
|
|
+ value: item,
|
|
|
|
+ child: PlatformItems.buildItem(item),
|
|
|
|
+ ),
|
|
|
|
+ ),
|
|
|
|
+ ],
|
|
|
|
+ onChanged: (value) {
|
|
|
|
+ PlatformItems.onChanged(context, value!);
|
|
|
|
+ },
|
|
|
|
+ dropdownStyleData: DropdownStyleData(
|
|
|
|
+ width: 150,
|
|
|
|
+ padding: const EdgeInsets.symmetric(vertical: 6),
|
|
|
|
+ decoration: BoxDecoration(
|
|
|
|
+ borderRadius: BorderRadius.circular(4),
|
|
|
|
+ ),
|
|
|
|
+ offset: const Offset(0, 8),
|
|
|
|
+ ),
|
|
|
|
+ menuItemStyleData: MenuItemStyleData(
|
|
|
|
+ customHeights: [
|
|
|
|
+ ...List<double>.filled(PlatformItems.firstItems.length, 48),
|
|
|
|
+ ],
|
|
|
|
+ padding: const EdgeInsets.only(left: 16, right: 16),
|
|
|
|
+ ),
|
|
|
|
+ ),
|
|
|
|
+ ),
|
|
|
|
+ ),
|
|
|
|
+ Padding(
|
|
|
|
+ padding: const EdgeInsets.symmetric(horizontal: 8),
|
|
|
|
+ child: DropdownButtonHideUnderline(
|
|
|
|
+ child: DropdownButton2(
|
|
|
|
+ customButton: const Icon(Icons.pan_tool),
|
|
|
|
+ items: [
|
|
|
|
+ DropdownMenuItem(
|
|
|
|
+ child: Text('Maintenance'),
|
|
|
|
+ )
|
|
|
|
+ ],
|
|
|
|
+ onChanged: (value) => context.go('/maintenance'),
|
|
|
|
+ dropdownStyleData: DropdownStyleData(
|
|
|
|
+ width: 130,
|
|
|
|
+ padding: const EdgeInsets.symmetric(vertical: 6),
|
|
|
|
+ decoration: BoxDecoration(
|
|
|
|
+ borderRadius: BorderRadius.circular(4),
|
|
|
|
+ ),
|
|
|
|
+ offset: const Offset(0, 8),
|
|
|
|
+ ),
|
|
|
|
+ ),
|
|
|
|
+ ),
|
|
|
|
+ ),
|
|
|
|
+ Padding(
|
|
|
|
+ padding: const EdgeInsets.symmetric(horizontal: 8.0),
|
|
|
|
+ child: DropdownButtonHideUnderline(
|
|
|
|
+ child: DropdownButton2(
|
|
|
|
+ customButton: const Icon(Icons.logout),
|
|
|
|
+ items: [
|
|
|
|
+ ...LogoutItems.firstItems.map(
|
|
|
|
+ (item) => DropdownMenuItem<MenuItem>(
|
|
|
|
+ value: item,
|
|
|
|
+ child: LogoutItems.buildItem(item),
|
|
|
|
+ ),
|
|
|
|
+ ),
|
|
|
|
+ ],
|
|
|
|
+ onChanged: (value) {
|
|
|
|
+ LogoutItems.onChanged(context, value!);
|
|
|
|
+ },
|
|
|
|
+ dropdownStyleData: DropdownStyleData(
|
|
|
|
+ width: 170,
|
|
|
|
+ padding: const EdgeInsets.symmetric(vertical: 6),
|
|
|
|
+ decoration: BoxDecoration(
|
|
|
|
+ borderRadius: BorderRadius.circular(4),
|
|
|
|
+ ),
|
|
|
|
+ offset: const Offset(0, 8),
|
|
|
|
+ ),
|
|
|
|
+ menuItemStyleData: MenuItemStyleData(
|
|
|
|
+ customHeights: [
|
|
|
|
+ ...List<double>.filled(LogoutItems.firstItems.length, 48),
|
|
|
|
+ ],
|
|
|
|
+ padding: const EdgeInsets.only(left: 16, right: 16),
|
|
|
|
+ ),
|
|
|
|
+ ),
|
|
|
|
+ ),
|
|
|
|
+ ),
|
|
|
|
+ ],
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+class MenuItem {
|
|
|
|
+ const MenuItem({
|
|
|
|
+ required this.text,
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ final String text;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+mixin PlatformItems {
|
|
|
|
+ static const List<MenuItem> firstItems = [add, edit, list];
|
|
|
|
+
|
|
|
|
+ static const add = MenuItem(text: 'Add Platform');
|
|
|
|
+ static const edit = MenuItem(text: 'Edit Platform');
|
|
|
|
+ static const list = MenuItem(text: 'List Platform');
|
|
|
|
+
|
|
|
|
+ static Widget buildItem(MenuItem item) {
|
|
|
|
+ return Row(
|
|
|
|
+ children: [
|
|
|
|
+ Expanded(
|
|
|
|
+ child: Text(
|
|
|
|
+ item.text,
|
|
|
|
+ style: const TextStyle(
|
|
|
|
+ color: Colors.black,
|
|
|
|
+ ),
|
|
|
|
+ ),
|
|
|
|
+ ),
|
|
|
|
+ ],
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ static void onChanged(BuildContext context, MenuItem item) {
|
|
|
|
+ switch (item) {
|
|
|
|
+ case PlatformItems.add:
|
|
|
|
+ context.go('/addplatform');
|
|
|
|
+ break;
|
|
|
|
+ case PlatformItems.edit:
|
|
|
|
+ context.go('/listplatform/editplatform');
|
|
|
|
+ break;
|
|
|
|
+ case PlatformItems.list:
|
|
|
|
+ context.go('/listplatform');
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+mixin BugItems {
|
|
|
|
+ static const List<MenuItem> firstItems = [add, edit, list/*, listcomment*/];
|
|
|
|
+
|
|
|
|
+ static const add = MenuItem(text: 'Add Bug');
|
|
|
|
+ static const edit = MenuItem(text: 'Edit Bug');
|
|
|
|
+ static const list = MenuItem(text: 'List Bug');
|
|
|
|
+ static const listcomment = MenuItem(text: 'List Comment');
|
|
|
|
+
|
|
|
|
+ static Widget buildItem(MenuItem item) {
|
|
|
|
+ return Row(
|
|
|
|
+ children: [
|
|
|
|
+ Expanded(
|
|
|
|
+ child: Text(
|
|
|
|
+ item.text,
|
|
|
|
+ style: const TextStyle(
|
|
|
|
+ color: Colors.black,
|
|
|
|
+ ),
|
|
|
|
+ ),
|
|
|
|
+ ),
|
|
|
|
+ ],
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ static void onChanged(BuildContext context, MenuItem item) {
|
|
|
|
+ switch (item) {
|
|
|
|
+ case BugItems.add:
|
|
|
|
+ context.go('/addbug');
|
|
|
|
+ break;
|
|
|
|
+ case BugItems.edit:
|
|
|
|
+ context.go('/login/bug/editbug');
|
|
|
|
+ break;
|
|
|
|
+ case BugItems.list:
|
|
|
|
+ context.go('/login/bug');
|
|
|
|
+ break;
|
|
|
|
+ case BugItems.listcomment:
|
|
|
|
+ context.go('/listcomment');
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+mixin UserItems {
|
|
|
|
+ static const List<MenuItem> firstItems = [/*edit, change,*/ list];
|
|
|
|
+
|
|
|
|
+ static const edit = MenuItem(text: 'Edit User');
|
|
|
|
+ static const change = MenuItem(text: 'Edit Password');
|
|
|
|
+ static const list = MenuItem(text: 'List User');
|
|
|
|
+
|
|
|
|
+ static Widget buildItem(MenuItem item) {
|
|
|
|
+ return Row(
|
|
|
|
+ children: [
|
|
|
|
+ Expanded(
|
|
|
|
+ child: Text(
|
|
|
|
+ item.text,
|
|
|
|
+ style: const TextStyle(
|
|
|
|
+ color: Colors.black,
|
|
|
|
+ ),
|
|
|
|
+ ),
|
|
|
|
+ ),
|
|
|
|
+ ],
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ static void onChanged(BuildContext context, MenuItem item) {
|
|
|
|
+ switch (item) {
|
|
|
|
+ // case UserItems.edit:
|
|
|
|
+ // context.go('/signup/listuser/edit');
|
|
|
|
+ // break;
|
|
|
|
+ // case UserItems.change:
|
|
|
|
+ // context.go('/login/bug/editbug');
|
|
|
|
+ // break;
|
|
|
|
+ case UserItems.list:
|
|
|
|
+ context.go('/signup/listuser');
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+mixin ProjectItems {
|
|
|
|
+ static const List<MenuItem> firstItems = [add, edit, list, /*addMember, listMember*/];
|
|
|
|
+
|
|
|
|
+ static const add = MenuItem(text: 'Add Project');
|
|
|
|
+ static const edit = MenuItem(text: 'Edit Project');
|
|
|
|
+ static const list = MenuItem(text: 'List Project');
|
|
|
|
+ static const addMember = MenuItem(text: 'Add Member');
|
|
|
|
+ static const listMember = MenuItem(text: 'List Member');
|
|
|
|
+
|
|
|
|
+ static Widget buildItem(MenuItem item) {
|
|
|
|
+ return Row(
|
|
|
|
+ children: [
|
|
|
|
+ Expanded(
|
|
|
|
+ child: Text(
|
|
|
|
+ item.text,
|
|
|
|
+ style: const TextStyle(
|
|
|
|
+ color: Colors.black,
|
|
|
|
+ ),
|
|
|
|
+ ),
|
|
|
|
+ ),
|
|
|
|
+ ],
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ static void onChanged(BuildContext context, MenuItem item) {
|
|
|
|
+ switch (item) {
|
|
|
|
+ case ProjectItems.add:
|
|
|
|
+ context.go('/addproject');
|
|
|
|
+ break;
|
|
|
|
+ case ProjectItems.edit:
|
|
|
|
+ context.go('/editproject');
|
|
|
|
+ break;
|
|
|
|
+ case ProjectItems.list:
|
|
|
|
+ context.go('/listproject');
|
|
|
|
+ break;
|
|
|
|
+ case ProjectItems.addMember:
|
|
|
|
+ context.go('/addmember');
|
|
|
|
+ break;
|
|
|
|
+ case ProjectItems.listMember:
|
|
|
|
+ context.go('/listplatform/listmember');
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+mixin LogoutItems {
|
|
|
|
+ static const List<MenuItem> firstItems = [changepass, logout];
|
|
|
|
+
|
|
|
|
+ static const logout = MenuItem(text: 'Log Out');
|
|
|
|
+ static const changepass = MenuItem(text: 'Change Password');
|
|
|
|
+
|
|
|
|
+ static Widget buildItem(MenuItem item) {
|
|
|
|
+ return Row(
|
|
|
|
+ children: [
|
|
|
|
+ Expanded(
|
|
|
|
+ child: Text(
|
|
|
|
+ item.text,
|
|
|
|
+ style: const TextStyle(
|
|
|
|
+ color: Colors.black,
|
|
|
|
+ ),
|
|
|
|
+ ),
|
|
|
|
+ ),
|
|
|
|
+ ],
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ static void onChanged(BuildContext context, MenuItem item) {
|
|
|
|
+ switch (item) {
|
|
|
|
+ case LogoutItems.changepass:
|
|
|
|
+ context.go('/changepass');
|
|
|
|
+ break;
|
|
|
|
+ case LogoutItems.logout:
|
|
|
|
+ // context.go('/editproject');
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|