Skip to content

Commit

Permalink
feat(widgets): Use filled selected icon in app nav bar
Browse files Browse the repository at this point in the history
  • Loading branch information
realth000 committed Dec 12, 2023
1 parent 98bf929 commit 83ec784
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/widgets/app_navitaion_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ import 'package:tsdm_client/routes/screen_paths.dart';
class _NavigationBarItem {
_NavigationBarItem({
required this.icon,
required this.selectedIcon,
required this.label,
required this.targetPath,
});

final Icon icon;
final Icon selectedIcon;
final String label;
final String targetPath;
}
Expand All @@ -30,29 +32,34 @@ class _AppNavigationBarState extends ConsumerState<AppNavigationBar> {
final barItems = [
_NavigationBarItem(
icon: const Icon(Icons.home_outlined),
selectedIcon: const Icon(Icons.home),
label: context.t.navigation.homepage,
targetPath: ScreenPaths.homepage,
),
_NavigationBarItem(
icon: const Icon(Icons.topic_outlined),
selectedIcon: const Icon(Icons.topic),
label: context.t.navigation.topics,
targetPath: ScreenPaths.topic,
),
_NavigationBarItem(
icon: const Icon(Icons.person_outline),
selectedIcon: const Icon(Icons.person),
label: context.t.navigation.profile,
targetPath: ScreenPaths.profile,
),
_NavigationBarItem(
icon: const Icon(Icons.settings_outlined),
selectedIcon: const Icon(Icons.settings),
label: context.t.navigation.settings,
targetPath: ScreenPaths.settings,
),
];

return NavigationBar(
destinations: barItems
.map((e) => NavigationDestination(icon: e.icon, label: e.label))
.map((e) => NavigationDestination(
icon: e.icon, selectedIcon: e.selectedIcon, label: e.label))
.toList(),
selectedIndex: ref.watch(appNavigationBarIndexProvider),
onDestinationSelected: (index) {
Expand Down

0 comments on commit 83ec784

Please sign in to comment.