在底部 sheet 打开时限制用户与 UI 其余部分的交互
Restrict user interaction with rest of the UI while bottom sheet is open
当底部 sheet 打开时,我必须避免用户与 UI 的其余部分(底部 sheet 以上)进行交互。
_scaffoldKey.currentState.showBottomSheet((context) {
return sheetWidget();
});
类似于 Dim Screen and Block Interaction with BottomSheets 这个。在 Flutter
.
中不知道要实现这个
想听听一些提示,谢谢!
您可以使用 showModalBottomSheet。它是“模态底部 sheet 是菜单或对话框的替代品,可防止用户与应用程序的其余部分进行交互。”
您的代码现在将是:
showModalBottomSheet<void>(
context: context,
builder: (BuildContext context) {
return sheetWidget();
});
试试 showModalBottomSheet()
它会弹出一个 BottomSheetModal,而 UI 的其余部分是 Dim,如果您单击 Modal,Modal 将返回。
访问https://api.flutter.dev/flutter/material/showModalBottomSheet.html查看使用情况
当底部 sheet 打开时,我必须避免用户与 UI 的其余部分(底部 sheet 以上)进行交互。
_scaffoldKey.currentState.showBottomSheet((context) {
return sheetWidget();
});
类似于 Dim Screen and Block Interaction with BottomSheets 这个。在 Flutter
.
想听听一些提示,谢谢!
您可以使用 showModalBottomSheet。它是“模态底部 sheet 是菜单或对话框的替代品,可防止用户与应用程序的其余部分进行交互。”
您的代码现在将是:
showModalBottomSheet<void>(
context: context,
builder: (BuildContext context) {
return sheetWidget();
});
试试 showModalBottomSheet() 它会弹出一个 BottomSheetModal,而 UI 的其余部分是 Dim,如果您单击 Modal,Modal 将返回。
访问https://api.flutter.dev/flutter/material/showModalBottomSheet.html查看使用情况