nav_bar_page.dart
2.12 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import 'package:Parlando/account/page/account_page.dart';
import 'package:Parlando/home/home_page.dart';
import 'package:Parlando/poem/theme/tik_theme.dart';
import 'package:flutter/material.dart';
class NavBarPage extends StatefulWidget {
const NavBarPage({Key? key, required this.initialPage}) : super(key: key);
final String initialPage;
@override
NavBarPageState createState() => NavBarPageState();
}
/// This is the private State class that goes with NavBarPage.
class NavBarPageState extends State<NavBarPage> {
String _currentPage = 'HomePage';
@override
void initState() {
super.initState();
_currentPage = widget.initialPage;
}
@override
Widget build(BuildContext context) {
final tabs = {
'HomePage': const Home(),
'UploadStatusPage': const AccountPage(),
'UserProfile': const AccountPage(),
};
return Scaffold(
body: tabs[_currentPage],
bottomNavigationBar: BottomNavigationBar(
items: const <BottomNavigationBarItem>[
BottomNavigationBarItem(
icon: Icon(
Icons.home_filled,
size: 24,
),
label: 'Home',
tooltip: '',
),
BottomNavigationBarItem(
icon: Icon(
Icons.add_circle_outline_rounded,
size: 50,
),
activeIcon: Icon(
Icons.add_circle_rounded,
size: 50,
),
label: '',
tooltip: '',
),
BottomNavigationBarItem(
icon: Icon(
Icons.person_rounded,
size: 26,
),
label: 'Profile',
tooltip: '',
)
],
backgroundColor: TikTheme.tertiaryColor,
currentIndex: tabs.keys.toList().indexOf(_currentPage),
selectedItemColor: TikTheme.primaryColor,
unselectedItemColor: const Color(0x53FFFFFF),
onTap: (i) => setState(() => _currentPage = tabs.keys.toList()[i]),
showSelectedLabels: true,
showUnselectedLabels: true,
type: BottomNavigationBarType.fixed,
),
);
}
}