Когда я переключаюсь с одной вкладки на другую в моем приложении, вкладка инициализации не вызывается. Какой метод лучше всего вызывать при переключении индекса?
return new Scaffold(
appBar: new AppBar(
title: new Text('ConnectU'),
backgroundColor: Colors.blueGrey[600],
actions: <Widget>[
new FlatButton(
child: new Text('Logout',
style: new TextStyle(fontSize: 17.0, color: Colors.white)),
onPressed: signOut)
],
),
body: _children[_currentIndex], // new
bottomNavigationBar: BottomNavigationBar(
onTap: onTabTapped, // new
currentIndex: _currentIndex,
selectedItemColor: Colors.blueGrey,
unselectedItemColor: Colors.blueGrey[200],// new
items: [
new BottomNavigationBarItem(
icon: Icon(Icons.home),
title: Text('Home'),
),
new BottomNavigationBarItem(
icon: Icon(Icons.search),
title: Text('Search'),
),
new BottomNavigationBarItem(
icon: Icon(Icons.add),
title: Text('Add'),
),
new BottomNavigationBarItem(
icon: Icon(Icons.mail),
title: Text('Messages'),
),
new BottomNavigationBarItem(
icon: Icon(Icons.person),
title: Text('Profile')
)
],
),
);
}
Это мой код для панели навигации.
class homeIndexState extends State<playerHomePageIndex> {
List<Post> postList;
final _textEditingController = TextEditingController();
final databaseReference = Firestore.instance;
@override
Widget build(BuildContext context) {
return Scaffold(
body: showTodoList(),
);
}
@override
void initState() {
super.initState();
//_checkEmailVerification();
postList = new List();
postList.clear();
popList();
}
Это состояние инициализации, которое я пытаюсь вызвать. Какой метод будет вызван вместо этого?