, так что я начинающий флаттер, и я разрабатываю приложение флаттера, в котором пользователь должен войти в систему, после чего страница «HomePageEtud» должна направить его на разные страницы, проблема в том, что я пробовал этот код, но он не сработал. может быть полезно спасибо
class HomePageEtud extends StatefulWidget {
final FirebaseUser currentUser;
HomePageEtud(this.currentUser);
@override
_HomePageState createState() => _HomePageState();
callpage(int currentIndex) async {
switch (currentIndex) {
//case 0 : Navigator.pushNamed(context,'/Etud/Reminder');
case 1 : return ForumPage();
case 2 : return ReminderPage(currentUser);
break;
default: SchedulePage(currentUser);
}
}
}
class _HomePageState extends State<HomePageEtud> {
final db = Firestore.instance;
int _currentIndex=0;
FirebaseUser currentUser ;
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: HomePageEtud(currentUser).callpage(_currentIndex),
bottomNavigationBar: new BottomNavigationBar(
currentIndex: _currentIndex,
items: [
new BottomNavigationBarItem(icon: new Icon(Icons.school),title: new Text("schedule"),backgroundColor: Colors.black),
new BottomNavigationBarItem(icon: new Icon(Icons.people),title: new Text("Forum"),backgroundColor: Colors.black),
new BottomNavigationBarItem(icon: new Icon(Icons.calendar_today),title: new Text("Reminder"),backgroundColor: Colors.black),
],
onTap: (value){
_currentIndex = value;
setState(() {
}
...