考虑我有两个视图,"订单"视图和"订单详细信息"视图。
我想在"订单"视图上显示一个叠加层(底部的小部分),当用户选择订单时,我们显示详细信息视图,但我想继续显示叠加层,我想推送路线更改,以便后退按钮等工作。
这可行吗
使用 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),
),
),
);
},
);
},
),
),
);
}