flutter - Flutter:即使用户操作更改了路线,也显示覆盖
问题描述
考虑我有两个视图,订单视图和订单详细信息视图。
我想在订单视图上显示一个叠加层(底部的小部分),当用户选择一个订单时,我们会显示详细信息视图,但我想继续显示叠加层,我想推送路线更改所以返回按钮等工作。
这是可行的吗
解决方案
使用showModalBottomSheet
更多示例:modal_bottom_sheet_demo persistent_bottom_sheet_demo
考试:
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Modal bottom sheet'),
),
body: Center(
child: RaisedButton(
child: const Text('SHOW BOTTOM SHEET'),
onPressed: () {
showModalBottomSheet<void>(
context: context,
builder: (BuildContext context) {
return Container(
child: Padding(
padding: const EdgeInsets.all(32.0),
child: Text(
'This is the modal bottom sheet. Tap anywhere to dismiss.',
textAlign: TextAlign.center,
style: TextStyle(
color: Theme.of(context).accentColor, fontSize: 24.0),
),
),
);
},
);
},
),
),
);
}
推荐阅读
- javascript - 遍历对象数组并获得一个新的对象数组
- sapui5 - 我们可以将 Node 包包含到 UI5 工具中吗
- django - 如何用 Django 实现 Angular
- microsoft-teams - 无法通过导航器连接到团队帐户
- javascript - 是的验证库 TypeError:yup__WEBPACK_IMPORTED_MODULE_0__ 不是函数
- c# - c#.net 中的 Block.io 支付网关集成
- sql - 如何使用正则表达式选择分组
- python - 按日期顺序组织数据行 Pandas Python
- laravel - 在 laravel 中使用模型不起作用,但在使用路由时起作用
- vue.js - fs 包不在 nuxt 的客户端