从登录页面切换到在应用程序中保留底部栏的页面后,我最近收到此错误。换页后,我不明白这里发生了什么。这是我的登录页面:
Widget loginPage(BuildContext context) {
return Scaffold(
resizeToAvoidBottomPadding: false,
body: Form(
key: _loginKey,
child: Container(
height: MediaQuery.of(context).size.height,
decoration: BoxDecoration(
color: Colors.white,
),
child: Column(
children: <Widget>[
Expanded(
child: MaterialButton(
elevation: 8,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30.0),
),
color: Colors.teal,
onPressed: () {
if (validateAndSave()) {
FirebaseAuth.instance
.signInWithEmailAndPassword(
email: _email, password: _pword)
.then((FirebaseUser user) {
print('Move To homePage');
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (BuildContext context) =>
BottomAppBar()));
return user;
}).catchError((e) {
print(e);
print('Somethings wrong');
// return user;
});
print('Sign In With');
}
},
登录后,用户将被转到该页面,在该页面的底部有一个栏,允许他们在页面之间切换。
@override
Widget build(BuildContext context) {
return MaterialApp(
home: _buildBottom(context)
);
}
Widget _buildBottom(BuildContext context){
return Scaffold(
key: _scaffoldKey,
bottomNavigationBar: BubbleBottomBar(
opacity: .2,
currentIndex: _currentIndex,
onTap: _onTabTapped,
borderRadius: BorderRadius.vertical(top: Radius.circular(14)),
elevation: 8,
hasInk: true,
inkColor: Colors.black12,
items: [
BubbleBottomBarItem(
backgroundColor: Colors.teal,
icon: Icon(
FontAwesomeIcons.personBooth,
color: Colors.black,
),
activeIcon: Icon(
FontAwesomeIcons.personBooth,
color: Colors.teal,
),
title: Text("Nearest",),),
BubbleBottomBarItem(
backgroundColor: Colors.teal,
icon: Icon(
FontAwesomeIcons.userCircle,
color: Colors.black,
),
activeIcon: Icon(
FontAwesomeIcons.userCircle,
color: Colors.teal,
),
title: Text("Logs")),
BubbleBottomBarItem(
backgroundColor: Colors.teal,
icon: Icon(
Icons.folder_open,
color: Colors.black,
),
activeIcon: Icon(
Icons.folder_open,
color: Colors.teal,
),
title: Text("Folders")),
BubbleBottomBarItem(
backgroundColor: Colors.teal,
icon: Icon(
Icons.menu,
color: Colors.black,
),
activeIcon: Icon(
Icons.menu,
color: Colors.teal,
),
title: Text("Menu"))
],
),
body: Builder(builder: (context) => pages[_currentIndex]));
}
}
我已经添加了脚手架,但是,不明白这里出了什么问题。