我正在尝试有一个全屏进度hud (微调器),这是真正的全屏。我现在的脚手架看起来像这样:
Widget build(BuildContext context) {
return WillPopScope(
onWillPop: () async =>
!await navigatorKeys[currentTab].currentState.maybePop(),
child: Scaffold(
resizeToAvoidBottomPadding: false,
resizeToAvoidBottomInset: false,
body: ModalProgressHUD(child: buildTabs(context), inAsyncCall: _saving, color: Colors.grey, opacity: 0.5),
bottomNavigationBar: BottomNavigation(
currentTab: currentTab,
onSelectTab: _selectTab,
),
),
);
}基于本教程(https://medium.com/coding-with-flutter/flutter-case-study-multiple-navigators-with-bottomnavigationbar-90eb6caa6dbf)。在"body“中,我有一个小部件(来自https://pub.dev/packages/modal_progress_hud的”ModalProgressHUD“),它将覆盖整个屏幕,但底部导航栏被排除在覆盖之外。
我怎么能在底部导航栏仍然是一个显示一些“正在进行”的微调器的全屏覆盖小部件呢?
谢谢马丁
发布于 2019-06-12 23:55:51
尴尬..。就在我发帖之后,我发现了它。只需将"WillPopScope“包装到ModalProgressHud小部件中,就可以了
@override
Widget build(BuildContext context) {
return ModalProgressHUD(child: buildScaffoldWidget(context), inAsyncCall: _saving, color: Colors.grey, opacity: 0.5);
}
Widget buildScaffoldWidget(BuildContext context) {
return WillPopScope(
onWillPop: () async =>
!await navigatorKeys[currentTab].currentState.maybePop(),
child: Scaffold(
resizeToAvoidBottomPadding: false,
resizeToAvoidBottomInset: false,
body: buildTabs(context),
bottomNavigationBar: BottomNavigation(
currentTab: currentTab,
onSelectTab: _selectTab,
),
),
);
}https://stackoverflow.com/questions/56566074
复制相似问题