如何解决Flutter:如何在从底部导航选项卡导航到下一个屏幕时隐藏上一个屏幕的应用栏
当我从底部导航导航到单击选项卡上的下一个屏幕时,我想隐藏/更改应用栏标题。
这是我的底部导航代码
class Employee extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
debugShowCheckedModeBanner: false,theme: new ThemeData(
primaryColor: Colors.blue
),home: EmployeeNavigation(),);
}
}
int _selectedTab = 0;
final _pageOptions = [
EmployeeDashboard(),RequestForLeave(),MyAttendance(),Profile()
];
class EmployeeNavigation extends StatefulWidget {
@override
State<StatefulWidget> createState() {
return EmployeeNavigationState();
}
}
class EmployeeNavigationState extends State<EmployeeNavigation> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: new MyAppBar(title: Text("Home"),onpressed: (){
Navigator.push(context,MaterialPageRoute(builder: (context)=>Profile()));
}),drawer:Emp_DrawerCode(),body: _pageOptions[_selectedTab],bottomNavigationBar: BottomNavigationBar(
type: BottomNavigationBarType.fixed,currentIndex: _selectedTab,onTap: (value) {
print(value);
setState(() {
_selectedTab = value;
});
},items: [
BottomNavigationBarItem(icon: Icon(Icons.home),label: "Home"),BottomNavigationBarItem(icon: Icon(Icons.time_to_leave),label: "Leave"),BottomNavigationBarItem(icon: Icon(Icons.history),label: "Attendance"),BottomNavigationBarItem(
icon: CircleAvatar(
radius: 14,backgroundImage: AssetImage("assets/images/user_2.png"),),label: "Profile",],));
}
}
当我点击离开标签然后离开屏幕显示但它也显示主屏幕应用栏
这是我在离开屏幕上调用的小部件
Widget build(BuildContext context) {
return new Scaffold(
drawer: drawer(),appBar: new MyAppBar(
title: Text("Request for leave"),onpressed: () {
Navigator.push(
context,MaterialPageRoute(builder: (context) => Profile()));
},
请帮助我做错的地方
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。