我正在尝试检测Persistent BottomSheet的关闭。我使用scaffoldKey.currentState.showBottomSheet打开工作表。 showBottomSheet仅返回一个PersistentBottomSheetController,您不能向其添加侦听器。我不知道还有什么方法可以检测纸页的收盘情况。我需要知道何时关闭工作表才能更改按钮的状态。
答案 0 :(得分:0)
为此,您使用WillPopScope
。底页即将关闭时,将调用onWillPop
:
// Place this widget somewhere in your bottom sheet.
WillPopScope(
onWillPop: () async {
// Return true if you want to allow the bottom sheet to be closed and false if not.
},
child: ..,
)
答案 1 :(得分:0)
您可以等待mEditText.setInputType(InputType.TYPE_CLASS_NUMBER);
的属性closed
暴露的未来
PersistentBottomSheetController