committed by
GitHub
21 changed files with 348 additions and 132 deletions
@ -0,0 +1,5 @@ |
|||||
|
export 'search.dart'; |
||||
|
export 'menu_drawer.dart'; |
||||
|
export 'my_favorite.dart'; |
||||
|
export 'notification_bar.dart'; |
||||
|
export 'quick_navigation.dart'; |
||||
@ -0,0 +1,76 @@ |
|||||
|
import 'package:components/widgets/menu/index.dart'; |
||||
|
import 'package:core/models/common.dart'; |
||||
|
import 'package:flutter/material.dart'; |
||||
|
|
||||
|
class MenuDrawer extends StatelessWidget { |
||||
|
const MenuDrawer({ |
||||
|
super.key, |
||||
|
this.activedMenu, |
||||
|
this.menus = const [], |
||||
|
required this.onMenuRefresh, |
||||
|
this.onMenuExpanded, |
||||
|
}); |
||||
|
|
||||
|
final String? activedMenu; |
||||
|
final List<Menu> menus; |
||||
|
final void Function(Menu menu)? onMenuExpanded; |
||||
|
final Future<void> Function() onMenuRefresh; |
||||
|
|
||||
|
@override |
||||
|
Widget build(BuildContext context) { |
||||
|
return RefreshIndicator( |
||||
|
onRefresh: onMenuRefresh, |
||||
|
child: Drawer( |
||||
|
width: 260, |
||||
|
child: Column( |
||||
|
children: [ |
||||
|
_buildLogo(), |
||||
|
Expanded( |
||||
|
child: SingleChildScrollView( |
||||
|
physics: const AlwaysScrollableScrollPhysics(), |
||||
|
child: Column( |
||||
|
children: [ |
||||
|
Navigation( |
||||
|
activedMenu: activedMenu, |
||||
|
menus: menus, |
||||
|
onMenuExpanded: onMenuExpanded, |
||||
|
), |
||||
|
], |
||||
|
), |
||||
|
) |
||||
|
), |
||||
|
], |
||||
|
), |
||||
|
), |
||||
|
); |
||||
|
} |
||||
|
|
||||
|
Widget _buildLogo() { |
||||
|
return Container( |
||||
|
height: 24, |
||||
|
margin: const EdgeInsets.all(10), |
||||
|
child: Row( |
||||
|
children: [ |
||||
|
Padding( |
||||
|
padding: const EdgeInsets.only(left: 10), |
||||
|
child: Image.asset( |
||||
|
'res/images/logo.png', |
||||
|
height: 20, |
||||
|
width: 20, |
||||
|
), |
||||
|
), |
||||
|
const Padding( |
||||
|
padding: EdgeInsets.only(left: 10), |
||||
|
child: Text( |
||||
|
'abp flutter', |
||||
|
style: TextStyle( |
||||
|
fontSize: 20, |
||||
|
fontWeight: FontWeight.w400, |
||||
|
), |
||||
|
), |
||||
|
), |
||||
|
], |
||||
|
), |
||||
|
); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,42 @@ |
|||||
|
import 'package:components/widgets/empty/index.dart'; |
||||
|
import 'package:flutter/material.dart'; |
||||
|
import 'package:get/get.dart'; |
||||
|
import 'package:platforms/modes/menu.dto.dart'; |
||||
|
|
||||
|
class MyFavorite extends StatelessWidget { |
||||
|
const MyFavorite({ |
||||
|
super.key, |
||||
|
required this.favoriteMenus, |
||||
|
required this.favoriteMenuBuilder, |
||||
|
}); |
||||
|
|
||||
|
final List<UserFavoriteMenuDto> favoriteMenus; |
||||
|
final Widget Function(UserFavoriteMenuDto favoriteMenu) favoriteMenuBuilder; |
||||
|
|
||||
|
@override |
||||
|
Widget build(BuildContext context) { |
||||
|
return ExpansionTile( |
||||
|
initiallyExpanded: true, |
||||
|
title: Text('Label:MyFavorite'.tr, |
||||
|
style: Theme.of(context).textTheme.titleMedium, |
||||
|
), |
||||
|
children: [ |
||||
|
GridView.builder( |
||||
|
shrinkWrap: true, |
||||
|
physics: const NeverScrollableScrollPhysics(), |
||||
|
itemCount: favoriteMenus.length, |
||||
|
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( |
||||
|
crossAxisCount: 4, |
||||
|
crossAxisSpacing: 5, |
||||
|
), |
||||
|
itemBuilder: (BuildContext context, int index) { |
||||
|
if (index >= favoriteMenus.length) { |
||||
|
return Empty.none; |
||||
|
} |
||||
|
return favoriteMenuBuilder(favoriteMenus[index]); |
||||
|
}, |
||||
|
), |
||||
|
], |
||||
|
); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,55 @@ |
|||||
|
import 'package:bruno/bruno.dart'; |
||||
|
import 'package:components/widgets/empty/index.dart'; |
||||
|
import 'package:flutter/material.dart'; |
||||
|
import 'package:notifications/models/common.dart'; |
||||
|
import 'package:notifications/models/notification.dart'; |
||||
|
|
||||
|
class NotificationBar extends StatelessWidget { |
||||
|
const NotificationBar({ |
||||
|
super.key, |
||||
|
required this.notifications |
||||
|
}); |
||||
|
|
||||
|
final List<NotificationPaylod> notifications; |
||||
|
|
||||
|
@override |
||||
|
Widget build(BuildContext context) { |
||||
|
if (notifications.isEmpty) { |
||||
|
return Empty.none; |
||||
|
} |
||||
|
return SizedBox( |
||||
|
height: 40, |
||||
|
child: SingleChildScrollView( |
||||
|
child: Column( |
||||
|
children: notifications.map<BrnNoticeBar>((payload) { |
||||
|
return BrnNoticeBar( |
||||
|
padding: const EdgeInsets.only(left: 5, right: 5, top: 3), |
||||
|
leftWidget: Image.asset( |
||||
|
'res/images/notification.png', |
||||
|
height: 30, |
||||
|
width: 30, |
||||
|
), |
||||
|
content: payload.title, |
||||
|
marquee: true, |
||||
|
noticeStyle: _mapNoticeStyles(payload.severity), |
||||
|
); |
||||
|
}).toList(), |
||||
|
), |
||||
|
), |
||||
|
); |
||||
|
} |
||||
|
|
||||
|
NoticeStyle _mapNoticeStyles(NotificationSeverity? severity) { |
||||
|
if (severity == null) return NoticeStyles.normalNoticeWithArrow; |
||||
|
switch (severity) { |
||||
|
case NotificationSeverity.info: |
||||
|
case NotificationSeverity.success: |
||||
|
return NoticeStyles.succeedWithArrow; |
||||
|
case NotificationSeverity.fatal: |
||||
|
case NotificationSeverity.error: |
||||
|
return NoticeStyles.failWithArrow; |
||||
|
case NotificationSeverity.warn: |
||||
|
return NoticeStyles.warningWithArrow; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,33 @@ |
|||||
|
import 'package:flutter/material.dart'; |
||||
|
import 'package:get/get.dart'; |
||||
|
|
||||
|
class QuickNavigation extends StatelessWidget { |
||||
|
const QuickNavigation({ |
||||
|
super.key, |
||||
|
this.menus = const [], |
||||
|
}); |
||||
|
|
||||
|
final List<Widget> menus; |
||||
|
|
||||
|
@override |
||||
|
Widget build(BuildContext context) { |
||||
|
return ExpansionTile( |
||||
|
initiallyExpanded: true, |
||||
|
title: Text('Label:QuickNavigation'.tr, |
||||
|
style: Theme.of(context).textTheme.titleMedium, |
||||
|
), |
||||
|
children: [ |
||||
|
SizedBox( |
||||
|
height: 120, |
||||
|
child: GridView.count( |
||||
|
shrinkWrap: true, |
||||
|
crossAxisCount: 4, |
||||
|
crossAxisSpacing: 5, |
||||
|
physics: const NeverScrollableScrollPhysics(), |
||||
|
children: menus, |
||||
|
), |
||||
|
), |
||||
|
], |
||||
|
); |
||||
|
} |
||||
|
} |
||||
|
After Width: | Height: | Size: 6.4 KiB |
Loading…
Reference in new issue