Fai*_*Dae 2 android ios dart flutter bottom-sheet
我正在使用GetX包来显示bottomSheet.
我希望用户能够在我的底部工作表打开时单击屏幕,如下图所示。
我怎样才能做到这一点?
根据Flutter 文档:
模态底部表单是菜单或对话框的替代方案,可防止用户与应用程序的其余部分进行交互。
底部表单的主要目的是防止用户与应用程序的其余部分交互。
使用持久的底部工作表,即使用showBottomSheet.
密切相关的小部件是一个持久的底部表单,它显示补充应用程序主要内容的信息,而不会阻止用户与应用程序交互。
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return const MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
body: showSheet(),
),
);
}
}
class showSheet extends StatefulWidget {
const showSheet({Key? key}) : super(key: key);
@override
State<showSheet> createState() => _showSheetState();
}
class _showSheetState extends State<showSheet> {
void displayPersistentBottomSheet() {
Scaffold.of(context).showBottomSheet<void>((BuildContext context) {
return Container(
color: Colors.amber,
height: 200, // Change this according to your need
child: const Center(child: Text("Image Filter Here")),
);
});
}
@override
Widget build(BuildContext context) {
return Center(
child: FilledButton(
onPressed: displayPersistentBottomSheet,
child: const Text(
'Draggable Widget Here',
style: TextStyle(color: Colors.white),
),
),
);
}
}
Run Code Online (Sandbox Code Playgroud)
不幸的是,没有,因为getx仅支持模态底部表bottomShet的替代方案,并且没有任何持久底部表的替代方案。
| 归档时间: |
|
| 查看次数: |
790 次 |
| 最近记录: |