From b5b81b01570e8e89a70233dcda46bfa05cc68781 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=85=B1=E5=A4=A9=E5=B0=8F=E7=A6=BD=E5=85=BD?= Date: Thu, 12 Dec 2024 23:53:59 +0800 Subject: [PATCH] v8.0.6+271 --- changelog/v8.0.6+271.md | 5 +++++ lib/src/widget/will_pop_interceptor.dart | 7 +++++-- pubspec.yaml | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 changelog/v8.0.6+271.md diff --git a/changelog/v8.0.6+271.md b/changelog/v8.0.6+271.md new file mode 100644 index 00000000..d0a47d47 --- /dev/null +++ b/changelog/v8.0.6+271.md @@ -0,0 +1,5 @@ +- 优化双击返回逻辑 + +-------------------- + +- Optimize double-click return logic \ No newline at end of file diff --git a/lib/src/widget/will_pop_interceptor.dart b/lib/src/widget/will_pop_interceptor.dart index 9ca9fd57..0a818835 100644 --- a/lib/src/widget/will_pop_interceptor.dart +++ b/lib/src/widget/will_pop_interceptor.dart @@ -1,4 +1,7 @@ +import 'dart:io'; + import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:get/get.dart'; import 'package:jhentai/src/pages/home_page.dart'; import 'package:jhentai/src/setting/style_setting.dart'; @@ -22,7 +25,7 @@ class _WillPopInterceptorState extends State { Widget build(BuildContext context) { return PopScope( child: widget.child, - canPop: false, + canPop: Platform.isAndroid ? false : true, onPopInvokedWithResult: (bool didPop, FormData? result) async { if (didPop) { return; @@ -30,7 +33,7 @@ class _WillPopInterceptorState extends State { final bool shouldPop = await _handlePopApp(); if (context.mounted && shouldPop) { - Navigator.pop(context, result); + SystemNavigator.pop(animated: true); } }, ); diff --git a/pubspec.yaml b/pubspec.yaml index f150d229..0ca8c3e2 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -2,7 +2,7 @@ name: jhentai description: A flutter app for E-Hentai/EXHentai publish_to: 'none' -version: 8.0.6+270 +version: 8.0.6+271 environment: sdk: '>=3.0.0 <4.0.0'