Updated dependencies
This commit is contained in:
128
lib/app.dart
128
lib/app.dart
@ -5,7 +5,7 @@ import 'dart:developer';
|
||||
import 'package:easy_debounce/easy_throttle.dart';
|
||||
import 'package:firebase_messaging/firebase_messaging.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:persistent_bottom_nav_bar_v2/persistent-tab-view.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;
|
||||
|
||||
@ -93,67 +93,75 @@ class _AppState extends State<App> with WidgetsBindingObserver {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return PersistentTabView(
|
||||
context,
|
||||
controller: App.bottomNavigator,
|
||||
navBarStyle: NavBarStyle.style6,
|
||||
hideNavigationBarWhenKeyboardShows: true,
|
||||
navBarHeight: MediaQuery.of(context).viewInsets.bottom > 0 ? 0.0 : kBottomNavigationBarHeight,
|
||||
backgroundColor: Theme.of(context).colorScheme.surface,
|
||||
decoration: const NavBarDecoration(
|
||||
border: Border(top: BorderSide(width: 1, color: Colors.grey)),
|
||||
),
|
||||
screenTransitionAnimation: const ScreenTransitionAnimation(animateTabTransition: true, curve: Curves.ease, duration: Duration(milliseconds: 200)),
|
||||
screens: const [
|
||||
Breaker(breaker: BreakerArea.timetable, child: Timetable()),
|
||||
Breaker(breaker: BreakerArea.talk, child: ChatList()),
|
||||
Breaker(breaker: BreakerArea.files, child: Files([])),
|
||||
Breaker(breaker: BreakerArea.more, child: Overhang()),
|
||||
],
|
||||
items: [
|
||||
PersistentBottomNavBarItem(
|
||||
activeColorPrimary: Theme.of(context).primaryColor,
|
||||
inactiveColorPrimary: Theme.of(context).colorScheme.secondary,
|
||||
icon: const Icon(Icons.calendar_month),
|
||||
title: "Vertretung"
|
||||
),
|
||||
PersistentBottomNavBarItem(
|
||||
activeColorPrimary: Theme.of(context).primaryColor,
|
||||
inactiveColorPrimary: Theme.of(context).colorScheme.secondary,
|
||||
icon: Consumer<ChatListProps>(
|
||||
builder: (context, value, child) {
|
||||
if(value.primaryLoading()) return const Icon(Icons.chat);
|
||||
int 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: const Icon(Icons.chat),
|
||||
);
|
||||
},
|
||||
),
|
||||
title: "Talk",
|
||||
),
|
||||
PersistentBottomNavBarItem(
|
||||
activeColorPrimary: Theme.of(context).primaryColor,
|
||||
inactiveColorPrimary: Theme.of(context).colorScheme.secondary,
|
||||
icon: const Icon(Icons.folder),
|
||||
title: "Dateien"
|
||||
),
|
||||
PersistentBottomNavBarItem(
|
||||
activeColorPrimary: Theme.of(context).primaryColor,
|
||||
inactiveColorPrimary: Theme.of(context).colorScheme.secondary,
|
||||
icon: const Icon(Icons.apps),
|
||||
title: "Mehr"
|
||||
),
|
||||
],
|
||||
);
|
||||
gestureNavigationEnabled: true,
|
||||
navBarOverlap: const NavBarOverlap.none(),
|
||||
backgroundColor: Theme.of(context).colorScheme.primary,
|
||||
|
||||
screenTransitionAnimation: const ScreenTransitionAnimation(curve: Curves.easeOutQuad, duration: Duration(milliseconds: 200)),
|
||||
tabs: [
|
||||
PersistentTabConfig(
|
||||
screen: const Breaker(breaker: BreakerArea.timetable, child: Timetable()),
|
||||
item: ItemConfig(
|
||||
activeForegroundColor: Theme.of(context).primaryColor,
|
||||
inactiveForegroundColor: Theme.of(context).colorScheme.secondary,
|
||||
icon: const Icon(Icons.calendar_month),
|
||||
title: "Vertretung"
|
||||
),
|
||||
),
|
||||
PersistentTabConfig(
|
||||
screen: const Breaker(breaker: BreakerArea.talk, child: ChatList()),
|
||||
item: ItemConfig(
|
||||
activeForegroundColor: Theme.of(context).primaryColor,
|
||||
inactiveForegroundColor: Theme.of(context).colorScheme.secondary,
|
||||
icon: Consumer<ChatListProps>(
|
||||
builder: (context, value, child) {
|
||||
if(value.primaryLoading()) return const Icon(Icons.chat);
|
||||
int 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: const Icon(Icons.chat),
|
||||
);
|
||||
},
|
||||
),
|
||||
title: "Talk",
|
||||
),
|
||||
),
|
||||
PersistentTabConfig(
|
||||
screen: const Breaker(breaker: BreakerArea.files, child: Files([])),
|
||||
item: ItemConfig(
|
||||
activeForegroundColor: Theme.of(context).primaryColor,
|
||||
inactiveForegroundColor: Theme.of(context).colorScheme.secondary,
|
||||
icon: const Icon(Icons.folder),
|
||||
title: "Dateien"
|
||||
),
|
||||
),
|
||||
PersistentTabConfig(
|
||||
screen: const Breaker(breaker: BreakerArea.more, child: Overhang()),
|
||||
item: ItemConfig(
|
||||
activeForegroundColor: Theme.of(context).primaryColor,
|
||||
inactiveForegroundColor: Theme.of(context).colorScheme.secondary,
|
||||
icon: const Icon(Icons.apps),
|
||||
title: "Mehr"
|
||||
),
|
||||
),
|
||||
],
|
||||
navBarBuilder: (config) => Style6BottomNavBar(
|
||||
navBarConfig: config,
|
||||
navBarDecoration: NavBarDecoration(
|
||||
border: const Border(top: BorderSide(width: 1, color: Colors.grey)),
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
|
Reference in New Issue
Block a user