|
@@ -31,12 +31,21 @@ class _CustomAppbarState extends State<CustomAppbar> {
|
|
|
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'),
|
|
|
)
|
|
|
],
|
|
|
- onChanged: (value) => context.go('/'),
|
|
|
+ dropdownStyleData: DropdownStyleData(
|
|
|
+ width: 80,
|
|
|
+ padding: const EdgeInsets.symmetric(vertical: 6),
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ borderRadius: BorderRadius.circular(4),
|
|
|
+ ),
|
|
|
+ offset: const Offset(0, 8),
|
|
|
+ ),
|
|
|
),
|
|
|
),
|
|
|
),
|
|
@@ -44,23 +53,20 @@ class _CustomAppbarState extends State<CustomAppbar> {
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 8.0),
|
|
|
child: DropdownButtonHideUnderline(
|
|
|
child: DropdownButton2(
|
|
|
- customButton: Text(
|
|
|
- 'Bug',
|
|
|
- style: TextStyle(fontSize: 15),
|
|
|
- ),
|
|
|
+ customButton: const Icon(Icons.person),
|
|
|
items: [
|
|
|
- ...MenuItems2.firstItems.map(
|
|
|
+ ...UserItems.firstItems.map(
|
|
|
(item) => DropdownMenuItem<MenuItem>(
|
|
|
value: item,
|
|
|
- child: MenuItems2.buildItem(item),
|
|
|
+ child: UserItems.buildItem(item),
|
|
|
),
|
|
|
),
|
|
|
],
|
|
|
onChanged: (value) {
|
|
|
- MenuItems2.onChanged(context, value!);
|
|
|
+ UserItems.onChanged(context, value!);
|
|
|
},
|
|
|
dropdownStyleData: DropdownStyleData(
|
|
|
- width: 150,
|
|
|
+ width: 100,
|
|
|
padding: const EdgeInsets.symmetric(vertical: 6),
|
|
|
decoration: BoxDecoration(
|
|
|
borderRadius: BorderRadius.circular(4),
|
|
@@ -69,7 +75,7 @@ class _CustomAppbarState extends State<CustomAppbar> {
|
|
|
),
|
|
|
menuItemStyleData: MenuItemStyleData(
|
|
|
customHeights: [
|
|
|
- ...List<double>.filled(MenuItems2.firstItems.length, 48),
|
|
|
+ ...List<double>.filled(UserItems.firstItems.length, 48),
|
|
|
],
|
|
|
padding: const EdgeInsets.only(left: 16, right: 16),
|
|
|
),
|
|
@@ -80,20 +86,50 @@ class _CustomAppbarState extends State<CustomAppbar> {
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 8.0),
|
|
|
child: DropdownButtonHideUnderline(
|
|
|
child: DropdownButton2(
|
|
|
- customButton: Text(
|
|
|
- 'Platform',
|
|
|
- style: TextStyle(fontSize: 15),
|
|
|
+ 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: 100,
|
|
|
+ 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.dynamic_form),
|
|
|
items: [
|
|
|
- ...MenuItems.firstItems.map(
|
|
|
+ ...PlatformItems.firstItems.map(
|
|
|
(item) => DropdownMenuItem<MenuItem>(
|
|
|
value: item,
|
|
|
- child: MenuItems.buildItem(item),
|
|
|
+ child: PlatformItems.buildItem(item),
|
|
|
),
|
|
|
),
|
|
|
],
|
|
|
onChanged: (value) {
|
|
|
- MenuItems.onChanged(context, value!);
|
|
|
+ PlatformItems.onChanged(context, value!);
|
|
|
},
|
|
|
dropdownStyleData: DropdownStyleData(
|
|
|
width: 150,
|
|
@@ -105,7 +141,7 @@ class _CustomAppbarState extends State<CustomAppbar> {
|
|
|
),
|
|
|
menuItemStyleData: MenuItemStyleData(
|
|
|
customHeights: [
|
|
|
- ...List<double>.filled(MenuItems.firstItems.length, 48),
|
|
|
+ ...List<double>.filled(PlatformItems.firstItems.length, 48),
|
|
|
],
|
|
|
padding: const EdgeInsets.only(left: 16, right: 16),
|
|
|
),
|
|
@@ -116,12 +152,21 @@ class _CustomAppbarState extends State<CustomAppbar> {
|
|
|
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),
|
|
|
+ ),
|
|
|
),
|
|
|
),
|
|
|
),
|
|
@@ -129,12 +174,21 @@ class _CustomAppbarState extends State<CustomAppbar> {
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 6),
|
|
|
child: DropdownButtonHideUnderline(
|
|
|
child: DropdownButton2(
|
|
|
+ customButton: const Icon(Icons.logout),
|
|
|
items: [
|
|
|
DropdownMenuItem(
|
|
|
child: Text('Log Out'),
|
|
|
)
|
|
|
],
|
|
|
onChanged: null,
|
|
|
+ dropdownStyleData: DropdownStyleData(
|
|
|
+ width: 130,
|
|
|
+ padding: const EdgeInsets.symmetric(vertical: 6),
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ borderRadius: BorderRadius.circular(4),
|
|
|
+ ),
|
|
|
+ offset: const Offset(0, 8),
|
|
|
+ ),
|
|
|
),
|
|
|
),
|
|
|
),
|
|
@@ -151,7 +205,7 @@ class MenuItem {
|
|
|
final String text;
|
|
|
}
|
|
|
|
|
|
-abstract class MenuItems {
|
|
|
+mixin PlatformItems {
|
|
|
static const List<MenuItem> firstItems = [add, edit, list];
|
|
|
|
|
|
static const add = MenuItem(text: 'Add Platform');
|
|
@@ -175,20 +229,20 @@ abstract class MenuItems {
|
|
|
|
|
|
static void onChanged(BuildContext context, MenuItem item) {
|
|
|
switch (item) {
|
|
|
- case MenuItems.add:
|
|
|
+ case PlatformItems.add:
|
|
|
context.go('/addplatform');
|
|
|
break;
|
|
|
- case MenuItems.edit:
|
|
|
+ case PlatformItems.edit:
|
|
|
context.go('/listplatform/editplatform');
|
|
|
break;
|
|
|
- case MenuItems.list:
|
|
|
+ case PlatformItems.list:
|
|
|
context.go('/listplatform');
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-abstract class MenuItems2 {
|
|
|
+mixin BugItems {
|
|
|
static const List<MenuItem> firstItems = [add, edit, list];
|
|
|
|
|
|
static const add = MenuItem(text: 'Add Bug');
|
|
@@ -212,70 +266,52 @@ abstract class MenuItems2 {
|
|
|
|
|
|
static void onChanged(BuildContext context, MenuItem item) {
|
|
|
switch (item) {
|
|
|
- case MenuItems2.add:
|
|
|
+ case BugItems.add:
|
|
|
context.go('/addbug');
|
|
|
break;
|
|
|
- case MenuItems2.edit:
|
|
|
+ case BugItems.edit:
|
|
|
context.go('/login/bug/editbug');
|
|
|
break;
|
|
|
- case MenuItems2.list:
|
|
|
+ case BugItems.list:
|
|
|
context.go('/login/bug');
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// class Header extends StatelessWidget implements PreferredSizeWidget {
|
|
|
-// final Text title;
|
|
|
-// final AppBar appBar;
|
|
|
-// final List<Widget> widgets;
|
|
|
+mixin UserItems {
|
|
|
+ static const List<MenuItem> firstItems = [/*edit, change,*/ list];
|
|
|
|
|
|
-// const Header(
|
|
|
-// {super.key,
|
|
|
-// required this.title,
|
|
|
-// required this.appBar,
|
|
|
-// required this.widgets});
|
|
|
+ static const edit = MenuItem(text: 'Edit User');
|
|
|
+ static const change = MenuItem(text: 'Edit Password');
|
|
|
+ static const list = MenuItem(text: 'List User');
|
|
|
|
|
|
-// @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: [
|
|
|
-// //todo hide kalo non login
|
|
|
-// ElevatedButton(
|
|
|
-// onPressed: () => context.go('/'),
|
|
|
-// style: ElevatedButton.styleFrom(surfaceTintColor: Colors.white),
|
|
|
-// child: Text(
|
|
|
-// 'Home',
|
|
|
-// style: TextStyle(color: Colors.black),
|
|
|
-// )),
|
|
|
-// ElevatedButton(
|
|
|
-// onPressed: () => context.go('/listplatform'),
|
|
|
-// style: ElevatedButton.styleFrom(surfaceTintColor: Colors.white),
|
|
|
-// child: Text(
|
|
|
-// 'Platform',
|
|
|
-// style: TextStyle(color: Colors.black),
|
|
|
-// ),
|
|
|
-// ),
|
|
|
-// ElevatedButton(
|
|
|
-// onPressed: () => context.go('/maintenance'),
|
|
|
-// style: ElevatedButton.styleFrom(surfaceTintColor: Colors.white),
|
|
|
-// child: Text(
|
|
|
-// 'Maintenance',
|
|
|
-// style: TextStyle(color: Colors.black),
|
|
|
-// ),
|
|
|
-// ),
|
|
|
-// Text('Log Out'),
|
|
|
-// ],
|
|
|
-// );
|
|
|
-// }
|
|
|
+ static Widget buildItem(MenuItem item) {
|
|
|
+ return Row(
|
|
|
+ children: [
|
|
|
+ Expanded(
|
|
|
+ child: Text(
|
|
|
+ item.text,
|
|
|
+ style: const TextStyle(
|
|
|
+ color: Colors.black,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ );
|
|
|
+ }
|
|
|
|
|
|
-// @override
|
|
|
-// Size get preferredSize => Size.fromHeight(appBar.preferredSize.height);
|
|
|
-// }
|
|
|
+ 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;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|