diff --git a/.github/workflows/flutter-web-deploy.yml b/.github/workflows/flutter-web-deploy.yml index 5829863eb..0e2e778c5 100644 --- a/.github/workflows/flutter-web-deploy.yml +++ b/.github/workflows/flutter-web-deploy.yml @@ -5,7 +5,7 @@ name: flutter_deer web deploy on: push: paths: - - 'pubspec.yaml' + - 'pubspec.yaml1' jobs: web_build_and_deploy: diff --git a/ios/Podfile b/ios/Podfile index 00d2e9470..73de607b0 100644 --- a/ios/Podfile +++ b/ios/Podfile @@ -2,7 +2,7 @@ platform :ios, '11.0' # source 'https://github.com/CocoaPods/Specs.git' -source 'https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git' +# source 'https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' diff --git a/lib/mvp/base_page.dart b/lib/mvp/base_page.dart index 3cd10ef2f..20b95f76c 100644 --- a/lib/mvp/base_page.dart +++ b/lib/mvp/base_page.dart @@ -38,10 +38,11 @@ mixin BasePageMixin on State< barrierDismissible: false, barrierColor: const Color(0x00FFFFFF), // 默认dialog背景色为半透明黑色,这里修改为透明(1.20添加属性) builder:(_) { - return PopScope( - onPopInvoked: (_) { + return WillPopScope( + onWillPop: () async { // 拦截到返回键,证明dialog被手动关闭 _isShowDialog = false; + return Future.value(true); }, child: buildProgress(), ); diff --git a/lib/widgets/double_tap_back_exit_app.dart b/lib/widgets/double_tap_back_exit_app.dart index d24bfe807..5adfaf860 100644 --- a/lib/widgets/double_tap_back_exit_app.dart +++ b/lib/widgets/double_tap_back_exit_app.dart @@ -25,19 +25,21 @@ class _DoubleTapBackExitAppState extends State { @override Widget build(BuildContext context) { - return PopScope( - canPop: _lastTime == null || DateTime.now().difference(_lastTime!) > widget.duration, - onPopInvoked: (didPop) { - if (!didPop) { - Toast.cancelToast(); - /// 不推荐使用 `dart:io` 的 exit(0) - SystemNavigator.pop(); - } else { - _lastTime = DateTime.now(); - Toast.show('再次点击退出应用'); - } - }, + return WillPopScope( + onWillPop: _isExit, child: widget.child, ); } + + Future _isExit() async { + if (_lastTime == null || DateTime.now().difference(_lastTime!) > widget.duration) { + _lastTime = DateTime.now(); + Toast.show('再次点击退出应用'); + return Future.value(false); + } + Toast.cancelToast(); + /// 不推荐使用 `dart:io` 的 exit(0) + await SystemNavigator.pop(); + return Future.value(true); + } }