From 6eb4244f3244a96fe6858261534cc03eb3de803c Mon Sep 17 00:00:00 2001 From: Kingkor Roy Tirtho Date: Fri, 24 Mar 2023 20:13:39 +0600 Subject: [PATCH] fix: bottom navbar first item icon color not changing on primary color change --- lib/components/root/spotube_navigation_bar.dart | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/components/root/spotube_navigation_bar.dart b/lib/components/root/spotube_navigation_bar.dart index be9762a5b..c58c2d5d7 100644 --- a/lib/components/root/spotube_navigation_bar.dart +++ b/lib/components/root/spotube_navigation_bar.dart @@ -57,9 +57,12 @@ class SpotubeNavigationBar extends HookConsumerWidget { buttonBackgroundColor: buttonColor, color: theme.colorScheme.background, height: 50, - items: [ - ...navbarTileList.map( - (e) { + animationDuration: const Duration(milliseconds: 350), + items: navbarTileList.map( + (e) { + /// Using this [Builder] as an workaround for the first item's + /// icon color not updating unless navigating to another page + return Builder(builder: (context) { return MouseRegion( cursor: SystemMouseCursors.click, child: Badge( @@ -67,13 +70,13 @@ class SpotubeNavigationBar extends HookConsumerWidget { label: Text(downloadCount.toString()), child: Icon( e.icon, - color: theme.colorScheme.primary, + color: Theme.of(context).colorScheme.primary, ), ), ); - }, - ), - ], + }); + }, + ).toList(), index: insideSelectedIndex.value, onTap: (i) { insideSelectedIndex.value = i;