62 lines
2.3 KiB
Dart
62 lines
2.3 KiB
Dart
import 'package:aitrainer_app/localization/app_localization.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
class BottomNavigator {
|
|
BottomNavigationBar buildBottomNavigator(BuildContext context, State state) {
|
|
return BottomNavigationBar(
|
|
currentIndex: 0, // this will be set when a new tab is tapped
|
|
backgroundColor: Colors.black12,
|
|
selectedItemColor: Colors.yellow,
|
|
unselectedItemColor: Colors.lightGreen,
|
|
type: BottomNavigationBarType.shifting,
|
|
showSelectedLabels: true,
|
|
items: [
|
|
BottomNavigationBarItem(
|
|
backgroundColor: Colors.black12,
|
|
icon: new Icon(Icons.home, color: Colors.lightGreen),
|
|
activeIcon: new Icon(Icons.home, color: Colors.yellow,),
|
|
title: new Text(AppLocalizations.of(context).translate("Home")),
|
|
),
|
|
BottomNavigationBarItem(
|
|
icon: new Icon(Icons.event, color: Colors.lightGreen),
|
|
activeIcon: new Icon(Icons.event, color: Colors.yellow,),
|
|
title: new Text(AppLocalizations.of(context).translate("Events")),
|
|
),
|
|
BottomNavigationBarItem(
|
|
icon: Icon(Icons.person, color: Colors.lightGreen,),
|
|
activeIcon: new Icon(Icons.person, color: Colors.yellow,),
|
|
title: Text(AppLocalizations.of(context).translate("Account"))
|
|
),
|
|
BottomNavigationBarItem(
|
|
icon: Icon(Icons.settings, color: Colors.lightGreen),
|
|
activeIcon: new Icon(Icons.settings, color: Colors.yellow,),
|
|
title: Text(AppLocalizations.of(context).translate("Settings"))
|
|
)
|
|
],
|
|
onTap:(index) {
|
|
// ignore: invalid_use_of_protected_member
|
|
switch (index) {
|
|
case 0:
|
|
Navigator.of(context).pop();
|
|
Navigator.of(context).pushNamed('home');
|
|
|
|
break;
|
|
case 1:
|
|
throw new StateError('This is a Dart exception on event.');
|
|
|
|
break;
|
|
case 2:
|
|
Navigator.of(context).pop();
|
|
Navigator.of(context).pushNamed('account');
|
|
|
|
break;
|
|
case 3:
|
|
Navigator.of(context).pop();
|
|
Navigator.of(context).pushNamed('settings');
|
|
|
|
break;
|
|
}
|
|
}
|
|
);
|
|
}
|
|
} |