我想知道,如果有人知道一种方法,以删除显示在appBar在颤振应用程序,当你使用Navigator。pushNamed转到另一个页面。我不希望它出现在这个结果页面上的原因是它来自导航,我希望用户使用注销按钮,这样会话就可以重新开始。
当前回答
如果导航到另一个页面。可以使用Navigator.pushReplacement()。如果你从登录导航到主屏幕,它可以被使用。或者你可以用。 AppBar (automaticallyImplyLeading: false)
其他回答
只是让它透明,没有行动,而现在
AppBar(
leading: IconButton(
icon: Icon(
Icons.arrow_back,
color: Colors.white.withOpacity(0),
),
onPressed: () {},
),
appBar: new AppBar(title: new Text("SmartDocs SPAY"),backgroundColor: Colors.blueAccent, automaticallyImplyLeading:false,
leading: new Container(),
),
工作正常
我认为解决办法如下
你实际上可以:
Don't want to display that ugly back button ( :] ), and thus go for : AppBar(...,automaticallyImplyLeading: false,...); Don't want the user to go back - replacing current view - and thus go for: Navigator.pushReplacementNamed(## your routename here ##); Don't want the user to go back - replacing a certain view back in the stack - and thus use: Navigator.pushNamedAndRemoveUntil(## your routename here ##, f(Route<dynamic>)→bool); where f is a function returning truewhen meeting the last view you want to keep in the stack (right before the new one); Don't want the user to go back - EVER - emptying completely the navigator stack with: Navigator.pushNamedAndRemoveUntil(context, ## your routename here ##, (_) => false);
AppBar小部件有一个名为automcallyimplyleading的属性。默认情况下,它的值为true。如果你不想让颤振自动构建后退按钮,然后只需使属性为假。
appBar: AppBar(
title: Text("YOUR_APPBAR_TITLE"),
automaticallyImplyLeading: false,
),
添加自定义后退按钮
appBar: AppBar(
title: Text("YOUR_APPBAR_TITLE"),
automaticallyImplyLeading: false,
leading: YOUR_CUSTOM_WIDGET(),
),
使用这个条子AppBar
SliverAppBar (
automaticallyImplyLeading: false,
elevation: 0,
brightness: Brightness.light,
backgroundColor: Colors.white,
pinned: true,
),
使用这个正常的Appbar
appBar: AppBar(
title: Text
("You decide on the appbar name"
style: TextStyle(color: Colors.black,),
elevation: 0,
brightness: Brightness.light,
backgroundColor: Colors.white,
automaticallyImplyLeading: false,
),
推荐文章
- 弹出时强制颤振导航器重新加载状态
- 禁用在android中打开导航抽屉的滑动手势
- 以编程方式滚动到ListView的末尾
- 颤振:扩展vs灵活
- 如何在颤振小部件中创建超链接?
- Android -如何覆盖“后退”按钮,所以它不完成()我的活动?
- 错误地使用父数据小部件。扩展小部件必须放置在flex小部件中
- 颤振给容器圆形边界
- Flutter: RenderBox没有布局
- 颤振插件未安装错误;当运行'扑动医生'时
- 如何改变appBar返回按钮的颜色
- 如何在扑动中设置按钮的宽度和高度?
- 在Flutter app上检查是否有网络连接
- 如何禁用或覆盖Android的“返回”按钮,在扑动?
- 如何在扑动中垂直和水平居中文本?