made app modules movable in their order
This commit is contained in:
29
lib/app.dart
29
lib/app.dart
@ -8,7 +8,6 @@ import 'package:flutter/material.dart';
|
||||
import 'state/app/modules/app_modules.dart';
|
||||
import 'package:persistent_bottom_nav_bar_v2/persistent_bottom_nav_bar_v2.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:badges/badges.dart' as badges;
|
||||
|
||||
import 'api/mhsl/breaker/getBreakers/getBreakersResponse.dart';
|
||||
import 'api/mhsl/server/userIndex/update/updateUserindex.dart';
|
||||
@ -93,7 +92,7 @@ class _AppState extends State<App> with WidgetsBindingObserver {
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => PersistentTabView(
|
||||
Widget build(BuildContext context) => Consumer<SettingsProvider>(builder: (context, settings, child) => PersistentTabView(
|
||||
controller: Main.bottomNavigator,
|
||||
navBarOverlap: const NavBarOverlap.none(),
|
||||
backgroundColor: Theme.of(context).colorScheme.primary,
|
||||
@ -101,29 +100,7 @@ class _AppState extends State<App> with WidgetsBindingObserver {
|
||||
|
||||
screenTransitionAnimation: const ScreenTransitionAnimation(curve: Curves.easeOutQuad, duration: Duration(milliseconds: 200)),
|
||||
tabs: [
|
||||
AppModule.getModule(Modules.timetable).toBottomTab(context),
|
||||
AppModule.getModule(Modules.talk).toBottomTab(
|
||||
context,
|
||||
itemBuilder: (icon) => Consumer<ChatListProps>(
|
||||
builder: (context, value, child) {
|
||||
if(value.primaryLoading()) return Icon(icon);
|
||||
var messages = value.getRoomsResponse.data.map((e) => e.unreadMessages).reduce((a, b) => a+b);
|
||||
return badges.Badge(
|
||||
showBadge: messages > 0,
|
||||
position: badges.BadgePosition.topEnd(top: -3, end: -3),
|
||||
stackFit: StackFit.loose,
|
||||
badgeStyle: badges.BadgeStyle(
|
||||
padding: const EdgeInsets.all(3),
|
||||
badgeColor: Theme.of(context).primaryColor,
|
||||
elevation: 1,
|
||||
),
|
||||
badgeContent: Text('$messages', style: const TextStyle(color: Colors.white, fontSize: 10, fontWeight: FontWeight.bold)),
|
||||
child: Icon(icon),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
AppModule.getModule(Modules.files).toBottomTab(context),
|
||||
...AppModule.getBottomBarModules(context).map((e) => e.toBottomTab(context)),
|
||||
|
||||
PersistentTabConfig(
|
||||
screen: const Breaker(breaker: BreakerArea.more, child: Overhang()),
|
||||
@ -142,7 +119,7 @@ class _AppState extends State<App> with WidgetsBindingObserver {
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
),
|
||||
),
|
||||
);
|
||||
));
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
|
Reference in New Issue
Block a user