parent
9af190000b
commit
11d61e163f
129
lib/home.dart
129
lib/home.dart
|
@ -110,81 +110,6 @@ class _HomeState extends State<Home> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<BottomNavigationBarItem> get _navigationItems {
|
|
||||||
switch (Provider.of<AuthModel>(context).activeAccount.platform) {
|
|
||||||
case PlatformType.github:
|
|
||||||
return [
|
|
||||||
BottomNavigationBarItem(
|
|
||||||
icon: Icon(Icons.rss_feed),
|
|
||||||
label: 'News',
|
|
||||||
),
|
|
||||||
BottomNavigationBarItem(
|
|
||||||
icon: _buildNotificationIcon(context, false),
|
|
||||||
activeIcon: _buildNotificationIcon(context, true),
|
|
||||||
label: 'Notification',
|
|
||||||
),
|
|
||||||
BottomNavigationBarItem(
|
|
||||||
icon: Icon(Icons.whatshot),
|
|
||||||
label: 'Trending',
|
|
||||||
),
|
|
||||||
BottomNavigationBarItem(
|
|
||||||
icon: Icon(Icons.search),
|
|
||||||
label: 'Search',
|
|
||||||
),
|
|
||||||
BottomNavigationBarItem(
|
|
||||||
icon: Icon(Icons.person),
|
|
||||||
activeIcon: Icon(Icons.person),
|
|
||||||
label: 'Me',
|
|
||||||
),
|
|
||||||
];
|
|
||||||
case PlatformType.gitlab:
|
|
||||||
return [
|
|
||||||
BottomNavigationBarItem(
|
|
||||||
icon: Icon(Icons.explore),
|
|
||||||
label: 'Explore',
|
|
||||||
),
|
|
||||||
BottomNavigationBarItem(
|
|
||||||
icon: Icon(Icons.group),
|
|
||||||
label: 'Groups',
|
|
||||||
),
|
|
||||||
BottomNavigationBarItem(
|
|
||||||
icon: Icon(Icons.search),
|
|
||||||
label: 'Search',
|
|
||||||
),
|
|
||||||
BottomNavigationBarItem(
|
|
||||||
icon: Icon(Icons.person),
|
|
||||||
label: 'Me',
|
|
||||||
),
|
|
||||||
];
|
|
||||||
case PlatformType.bitbucket:
|
|
||||||
return [
|
|
||||||
BottomNavigationBarItem(
|
|
||||||
icon: Icon(Icons.explore),
|
|
||||||
label: 'Explore',
|
|
||||||
),
|
|
||||||
BottomNavigationBarItem(
|
|
||||||
icon: Icon(Icons.group),
|
|
||||||
label: 'Teams',
|
|
||||||
),
|
|
||||||
BottomNavigationBarItem(
|
|
||||||
icon: Icon(Icons.person),
|
|
||||||
label: 'Me',
|
|
||||||
),
|
|
||||||
];
|
|
||||||
case PlatformType.gitea:
|
|
||||||
return [
|
|
||||||
BottomNavigationBarItem(
|
|
||||||
icon: Icon(Icons.group),
|
|
||||||
label: 'Organizations',
|
|
||||||
),
|
|
||||||
BottomNavigationBarItem(
|
|
||||||
icon: Icon(Icons.person),
|
|
||||||
label: 'Me',
|
|
||||||
),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
GlobalKey<NavigatorState> getNavigatorKey(int index) {
|
GlobalKey<NavigatorState> getNavigatorKey(int index) {
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -210,6 +135,49 @@ class _HomeState extends State<Home> {
|
||||||
return LoginScreen();
|
return LoginScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<BottomNavigationBarItem> navigationItems;
|
||||||
|
|
||||||
|
switch (auth.activeAccount.platform) {
|
||||||
|
case PlatformType.github:
|
||||||
|
navigationItems = [
|
||||||
|
BottomNavigationBarItem(icon: Icon(Icons.rss_feed), label: 'News'),
|
||||||
|
BottomNavigationBarItem(
|
||||||
|
icon: _buildNotificationIcon(context, false),
|
||||||
|
activeIcon: _buildNotificationIcon(context, true),
|
||||||
|
label: 'Notification'),
|
||||||
|
BottomNavigationBarItem(
|
||||||
|
icon: Icon(Icons.whatshot), label: 'Trending'),
|
||||||
|
BottomNavigationBarItem(icon: Icon(Icons.search), label: 'Search'),
|
||||||
|
BottomNavigationBarItem(
|
||||||
|
icon: Icon(Icons.person),
|
||||||
|
activeIcon: Icon(Icons.person),
|
||||||
|
label: 'Me'),
|
||||||
|
];
|
||||||
|
break;
|
||||||
|
case PlatformType.gitlab:
|
||||||
|
navigationItems = [
|
||||||
|
BottomNavigationBarItem(icon: Icon(Icons.explore), label: 'Explore'),
|
||||||
|
BottomNavigationBarItem(icon: Icon(Icons.group), label: 'Groups'),
|
||||||
|
BottomNavigationBarItem(icon: Icon(Icons.search), label: 'Search'),
|
||||||
|
BottomNavigationBarItem(icon: Icon(Icons.person), label: 'Me'),
|
||||||
|
];
|
||||||
|
break;
|
||||||
|
case PlatformType.bitbucket:
|
||||||
|
navigationItems = [
|
||||||
|
BottomNavigationBarItem(icon: Icon(Icons.explore), label: 'Explore'),
|
||||||
|
BottomNavigationBarItem(icon: Icon(Icons.group), label: 'Teams'),
|
||||||
|
BottomNavigationBarItem(icon: Icon(Icons.person), label: 'Me'),
|
||||||
|
];
|
||||||
|
break;
|
||||||
|
case PlatformType.gitea:
|
||||||
|
navigationItems = [
|
||||||
|
BottomNavigationBarItem(
|
||||||
|
icon: Icon(Icons.group), label: 'Organizations'),
|
||||||
|
BottomNavigationBarItem(icon: Icon(Icons.person), label: 'Me'),
|
||||||
|
];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
switch (theme.theme) {
|
switch (theme.theme) {
|
||||||
case AppThemeType.cupertino:
|
case AppThemeType.cupertino:
|
||||||
return WillPopScope(
|
return WillPopScope(
|
||||||
|
@ -228,7 +196,7 @@ class _HomeState extends State<Home> {
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
tabBar: CupertinoTabBar(
|
tabBar: CupertinoTabBar(
|
||||||
items: _navigationItems,
|
items: navigationItems,
|
||||||
currentIndex: auth.activeTab,
|
currentIndex: auth.activeTab,
|
||||||
onTap: (index) {
|
onTap: (index) {
|
||||||
if (auth.activeTab == index) {
|
if (auth.activeTab == index) {
|
||||||
|
@ -244,10 +212,15 @@ class _HomeState extends State<Home> {
|
||||||
);
|
);
|
||||||
default:
|
default:
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
body: _buildScreen(auth.activeTab),
|
body: IndexedStack(
|
||||||
|
index: auth.activeTab,
|
||||||
|
children: [
|
||||||
|
for (var i = 0; i < navigationItems.length; i++) _buildScreen(i)
|
||||||
|
],
|
||||||
|
),
|
||||||
bottomNavigationBar: BottomNavigationBar(
|
bottomNavigationBar: BottomNavigationBar(
|
||||||
selectedItemColor: theme.palette.primary,
|
selectedItemColor: theme.palette.primary,
|
||||||
items: _navigationItems,
|
items: navigationItems,
|
||||||
currentIndex: auth.activeTab,
|
currentIndex: auth.activeTab,
|
||||||
type: BottomNavigationBarType.fixed,
|
type: BottomNavigationBarType.fixed,
|
||||||
onTap: (int index) {
|
onTap: (int index) {
|
||||||
|
|
Loading…
Reference in New Issue