-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtab_navigation.dart
48 lines (43 loc) · 1.44 KB
/
tab_navigation.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import "package:flutter/material.dart";
import "package:go_router/go_router.dart";
import "package:flutter_gen/gen_l10n/app_localizations.dart";
class BottomNavigation extends StatefulWidget {
const BottomNavigation({super.key, required this.state, required this.child});
final StatefulShellRouteState state;
final Widget child;
@override
State<BottomNavigation> createState() => _BottomNavigationState();
}
class _BottomNavigationState extends State<BottomNavigation> {
late final l10n = AppLocalizations.of(context)!;
@override
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
top: false,
child: widget.child,
),
bottomNavigationBar: NavigationBar(
selectedIndex: widget.state.currentIndex,
onDestinationSelected: (i) => widget.state.goBranch(index: i),
destinations: [
NavigationDestination(
icon: const Icon(Icons.home_outlined),
selectedIcon: const Icon(Icons.home),
label: l10n.homeTabLabel,
),
NavigationDestination(
icon: const Icon(Icons.map_outlined),
selectedIcon: const Icon(Icons.map),
label: l10n.discoverTabLabel,
),
NavigationDestination(
icon: const Icon(Icons.person_outlined),
selectedIcon: const Icon(Icons.person),
label: l10n.profileTabLabel,
)
],
),
);
}
}