-
-
Notifications
You must be signed in to change notification settings - Fork 253
/
Copy pathbottom_nav_example.dart
43 lines (39 loc) · 1.27 KB
/
bottom_nav_example.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
import 'package:flutter/material.dart';
import 'package:stacked/stacked.dart';
import 'bottom_nav_example_viewmodel.dart';
class BottomNavExample extends StatefulWidget {
const BottomNavExample({Key? key}) : super(key: key);
@override
BottomNavExampleState createState() => BottomNavExampleState();
}
class BottomNavExampleState extends State<BottomNavExample> {
@override
Widget build(BuildContext context) {
return ViewModelBuilder<BottomNavExampleViewModel>.reactive(
builder: (context, viewModel, child) => Scaffold(
body: const NestedRouter(),
bottomNavigationBar: BottomNavigationBar(
elevation: 6,
backgroundColor: Colors.white,
currentIndex: viewModel.currentIndex,
onTap: viewModel.handleNavigation,
items: const [
BottomNavigationBarItem(
icon: Icon(Icons.favorite),
label: 'Favorites',
),
BottomNavigationBarItem(
icon: Icon(Icons.history),
label: 'History',
),
BottomNavigationBarItem(
icon: Icon(Icons.person),
label: 'Profile',
),
],
),
),
viewModelBuilder: () => BottomNavExampleViewModel(),
);
}
}