-
Notifications
You must be signed in to change notification settings - Fork 62
/
Copy pathhome_page.dart
53 lines (50 loc) · 1.62 KB
/
home_page.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
49
50
51
52
53
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:mobile_app/app_state/app_state.dart';
import 'package:provider/provider.dart';
import 'package:routemaster/routemaster.dart';
class HomePage extends StatelessWidget {
const HomePage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
final tabState = CupertinoTabPage.of(context);
final appState = Provider.of<AppState>(context);
return CupertinoTabScaffold(
controller: tabState.controller,
tabBar: CupertinoTabBar(
items: <BottomNavigationBarItem>[
BottomNavigationBarItem(
label: 'Feed',
icon: Icon(CupertinoIcons.list_bullet),
),
BottomNavigationBarItem(
label: 'Search',
icon: Icon(CupertinoIcons.search),
),
if (appState.showBonusTab)
BottomNavigationBarItem(
label: 'Bonus!',
icon: Icon(CupertinoIcons.exclamationmark),
),
BottomNavigationBarItem(
label: 'Notifications',
icon: Icon(CupertinoIcons.bell),
),
BottomNavigationBarItem(
label: 'Settings',
icon: Icon(CupertinoIcons.settings),
),
],
),
tabBuilder: (BuildContext context, int index) {
return HeroControllerScope(
controller: MaterialApp.createMaterialHeroController(),
child: PageStackNavigator(
key: ValueKey(tabState.page.paths[index]),
stack: tabState.stacks[index],
),
);
},
);
}
}