Skip to content

Commit

Permalink
Migrate from old BottomNavigationBar to NavigationBar
Browse files Browse the repository at this point in the history
  • Loading branch information
ggichure committed Oct 3, 2023
1 parent 0246fb5 commit ef44f0a
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions lib/thunder/widgets/bottom_nav_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -92,25 +92,20 @@ class _CustomBottomNavigationBarState extends State<CustomBottomNavigationBar> {
onHorizontalDragUpdate: _handleDragUpdate,
onHorizontalDragEnd: (DragEndDetails dragEndDetails) => _handleDragEnd(dragEndDetails, context),
onDoubleTap: state.bottomNavBarDoubleTapGestures == true ? () => _handleDoubleTap(context) : null,
child: BottomNavigationBar(
currentIndex: widget.selectedPageIndex,
showSelectedLabels: false,
showUnselectedLabels: false,
selectedItemColor: theme.colorScheme.primary,
type: BottomNavigationBarType.fixed,
unselectedFontSize: 20.0,
selectedFontSize: 20.0,
child: NavigationBar(selectedIndex: widget.selectedPageIndex,
backgroundColor: theme.colorScheme.surface,
labelBehavior:NavigationDestinationLabelBehavior.alwaysHide ,
elevation: 1,
items: [
BottomNavigationBarItem(
destinations: [
NavigationDestination(
icon: const Icon(Icons.dashboard_rounded),
label: AppLocalizations.of(context)!.feed,
),
BottomNavigationBarItem(
NavigationDestination(
icon: const Icon(Icons.search_rounded),
label: AppLocalizations.of(context)!.search,
),
BottomNavigationBarItem(
NavigationDestination(
icon: GestureDetector(
onLongPress: () {
HapticFeedback.mediumImpact();
Expand All @@ -119,20 +114,20 @@ class _CustomBottomNavigationBarState extends State<CustomBottomNavigationBar> {
child: const Icon(Icons.person_rounded)),
label: AppLocalizations.of(context)!.account,
),
BottomNavigationBarItem(
NavigationDestination(
icon: Badge(
isLabelVisible: inboxState.totalUnreadCount != 0,
label: Text(inboxState.totalUnreadCount > 99 ? '99+' : inboxState.totalUnreadCount.toString()),
child: const Icon(Icons.inbox_rounded),
),
label: AppLocalizations.of(context)!.inbox,
),
BottomNavigationBarItem(
NavigationDestination(
icon: const Icon(Icons.settings_rounded),
label: AppLocalizations.of(context)!.settings,
),
],
onTap: (index) {
onDestinationSelected: (index) {
if (context.read<ThunderBloc>().state.isFabOpen) {
context.read<ThunderBloc>().add(const OnFabToggle(false));
}
Expand Down

0 comments on commit ef44f0a

Please sign in to comment.