if (authbloc.state.value is Unauthenticated ||
context.name == '/login') {
- ProxmoxLoginStorage.fromLocalStorage()
- .then((storage) => storage?.invalidateAllSessions());
-
return MaterialPageRoute(
builder: (context) {
return StreamListener<PveAuthenticationState>(
Widget build(BuildContext context) {
final pageSelector = Provider.of<BehaviorSubject<int>>(context);
return BottomNavigationBar(
+ type: BottomNavigationBarType.fixed,
backgroundColor: Colors.white,
items: [
BottomNavigationBarItem(
- icon: Icon(
- Icons.dashboard,
- ),
- label: "Dashboard",
- ),
+ icon: Icon(
+ Icons.dashboard,
+ ),
+ label: "Dashboard",
+ backgroundColor: Theme.of(context).primaryColor),
BottomNavigationBarItem(
icon: Icon(
Icons.developer_board,
),
label: "Access",
),
+ BottomNavigationBarItem(
+ icon: Icon(
+ Icons.logout,
+ ),
+ label: "Sites",
+ ),
],
currentIndex: pageSelector.value,
- onTap: (index) => pageSelector.add(index));
+ onTap: (index) {
+ if (index == 3) {
+ Provider.of<PveAuthenticationBloc>(context).events.add(LoggedOut());
+ Navigator.of(context).pushReplacementNamed('/login');
+ } else {
+ pageSelector.add(index);
+ }
+ });
}
}
//backgroundColor: Colors.transparent,
elevation: 0.0,
automaticallyImplyLeading: false,
- actions: [
- IconButton(
- icon: Icon(Icons.input),
- tooltip: "Logout",
- onPressed: () {
- Provider.of<PveAuthenticationBloc>(context)
- .events
- .add(LoggedOut());
- Navigator.of(context).pushReplacementNamed('/login');
- })
- ],
bottom: TabBar(isScrollable: true, tabs: [
Tab(
text: 'Users',