FlutterBoost v1.17.1版本WillPopScope 组件无法接收android物理按键
Steps to Reproduce
WillPopScope( child: Scaffold(body:Container()), onWillPop: () { print("onWillPop"); return Future.value(false); });
- 用flutterboost打开页面。
- 然后按物理返回按键,没有执行onWillPop回调。
**Flutter Boost Version 1.17.1 **Target Platform: Android Target OS version/browser: Devices:
+1 感觉是 overlay 导致的
+1
感觉是 overlay 导致的
不是overlay的问题,试着自定义Route #914
这个问题是因为1.17上 lib/container/boost_page_route.dart中重写了willPop方法
@override
Future<RoutePopDisposition> willPop() {
return Future<RoutePopDisposition>.value(RoutePopDisposition.pop);
}
在这个只在1.17上有,我不知道用意何在,希望回复下 @nightfallsad
Boost 在BoostPageRoute中override了willPop的方法并且没有callSuper,导致willPopcallback没有被调用。 如果单纯想监听back事件的话,可以这么做 void didChangeDependencies() { super.didChangeDependencies(); BoostContainer.of(context).backPressedHandler = () => onBackPressed(); } 底层其实还是通过channel来传递back事件。对于为什么要在pageroute中忽略掉super的willpop事件,目前还没看懂
Steps to Reproduce
WillPopScope( child: Scaffold(body:Container()), onWillPop: () { print("onWillPop"); return Future.value(false); });
- 用flutterboost打开页面。
- 然后按物理返回按键,没有执行onWillPop回调。
**Flutter Boost Version 1.17.1 **Target Platform: Android Target OS version/browser: Devices:
1.17.1-hotfixes分支已经修复,稍后merge到1.22.4-hotfix分支