diff --git a/ci/version.code.txt b/ci/version.code.txt index 54d06cb..0c76f19 100644 --- a/ci/version.code.txt +++ b/ci/version.code.txt @@ -1 +1 @@ -v1.5.7 \ No newline at end of file +v1.5.8 \ No newline at end of file diff --git a/ci/version.info.txt b/ci/version.info.txt index 93a70f9..acdde4a 100644 --- a/ci/version.info.txt +++ b/ci/version.info.txt @@ -1,17 +1,3 @@ -v1.5.7 -- [x] 升级flutter到3.0.5 -- [x] TG群炸了, 换成新的, 在这里通知一下 -- [x] 更新发电功能, 点击小闪电点我发过电, 不捐助可以发电到8月 - -v1.5.6 -- [x] 从服务器获取最新的分流 -- [x] 优化排行榜/骑士榜/以及各个异步加载页的刷新逻辑 -- [x] 优化注册表单 - -v1.5.5 - -- [x] 对历史记录页面进行优化 -- [x] 对导入进行优化 -- [x] 增加了批量导出ZIP/PKI到文件夹 -- [x] 增加了从一个文件夹中导入所有ZIP/PKI的功能 -- [x] 增加了发电页面, 对作者发过电的用户会展示发电特权图标 +v1.5.8 +- [x] 解决历史记录图片不刷新的问题 +- [x] 增加退出是增加提示的选项(设置中寻找) \ No newline at end of file diff --git a/lib/basic/config/WillPopNotice.dart b/lib/basic/config/WillPopNotice.dart new file mode 100644 index 0000000..4ba89eb --- /dev/null +++ b/lib/basic/config/WillPopNotice.dart @@ -0,0 +1,41 @@ +import 'package:flutter/material.dart'; + +import '../Common.dart'; +import '../Method.dart'; + +const _propertyName = "willPopNotice"; + +late bool _willPopNotice; + +Future initWillPopNotice() async { + _willPopNotice = (await method.loadProperty(_propertyName, "false")) == "true"; +} + +bool willPopNotice() { + return _willPopNotice; +} + +Future _chooseWillPopNotice(BuildContext context) async { + String? result = + await chooseListDialog(context, "退出APP的提示", ["是", "否"]); + if (result != null) { + var target = result == "是"; + await method.saveProperty(_propertyName, "$target"); + _willPopNotice = target; + } +} + +Widget willPopNoticeSetting() { + return StatefulBuilder( + builder: (BuildContext context, void Function(void Function()) setState) { + return ListTile( + title: const Text("退出APP的提示"), + subtitle: Text(_willPopNotice ? "是" : "否"), + onTap: () async { + await _chooseWillPopNotice(context); + setState(() {}); + }, + ); + }, + ); +} diff --git a/lib/screens/AppScreen.dart b/lib/screens/AppScreen.dart index 1b286e2..1f6c63b 100644 --- a/lib/screens/AppScreen.dart +++ b/lib/screens/AppScreen.dart @@ -2,7 +2,9 @@ import 'dart:async'; import 'dart:io'; import 'package:flutter/material.dart'; +import 'package:flutter_styled_toast/flutter_styled_toast.dart'; import 'package:pikapika/basic/config/Version.dart'; +import 'package:pikapika/basic/config/WillPopNotice.dart'; import 'package:pikapika/screens/components/Badge.dart'; import 'package:uni_links/uni_links.dart'; import 'package:uri_to_file/uri_to_file.dart'; @@ -56,7 +58,7 @@ class _AppScreenState extends State { @override Widget build(BuildContext context) { - return Scaffold( + final body = Scaffold( body: IndexedStack( index: _selectedIndex, children: _widgetOptions, @@ -82,5 +84,37 @@ class _AppScreenState extends State { onTap: _onItemTapped, ), ); + return willPop(body); + } + + int _noticeTime = 0; + + Widget willPop(Scaffold body) { + return WillPopScope( + child: body, + onWillPop: () async { + if (willPopNotice()) { + final now = DateTime.now().millisecondsSinceEpoch; + if (_noticeTime + 3000 > now) { + return true; + } else { + _noticeTime = now; + showToast( + "再次返回将会退出应用程序", + context: context, + position: StyledToastPosition.center, + animation: StyledToastAnimation.scale, + reverseAnimation: StyledToastAnimation.fade, + duration: const Duration(seconds: 3), + animDuration: const Duration(milliseconds: 300), + curve: Curves.elasticOut, + reverseCurve: Curves.linear, + ); + return false; + } + } + return true; + }, + ); } } diff --git a/lib/screens/InitScreen.dart b/lib/screens/InitScreen.dart index 316fa39..7297f97 100644 --- a/lib/screens/InitScreen.dart +++ b/lib/screens/InitScreen.dart @@ -33,6 +33,7 @@ import 'package:pikapika/basic/config/UsingRightClickPop.dart'; import 'package:pikapika/basic/config/Version.dart'; import 'package:pikapika/basic/config/VolumeController.dart'; import 'package:pikapika/basic/config/ShadowCategoriesMode.dart'; +import 'package:pikapika/basic/config/WillPopNotice.dart'; import 'package:pikapika/screens/ComicInfoScreen.dart'; import 'package:pikapika/screens/PkzArchiveScreen.dart'; import 'package:uni_links/uni_links.dart'; @@ -97,6 +98,7 @@ class _InitScreenState extends State { await initAuthentication(); await reloadIsPro(); autoCheckNewVersion(); + await initWillPopNotice(); String? initUrl; if (Platform.isAndroid || Platform.isIOS) { diff --git a/lib/screens/SettingsScreen.dart b/lib/screens/SettingsScreen.dart index eed52c8..b4a2ba5 100644 --- a/lib/screens/SettingsScreen.dart +++ b/lib/screens/SettingsScreen.dart @@ -32,6 +32,7 @@ import 'package:pikapika/screens/components/RightClickPop.dart'; import '../basic/config/Authentication.dart'; import '../basic/config/UsingRightClickPop.dart'; +import '../basic/config/WillPopNotice.dart'; import 'CleanScreen.dart'; import 'MigrateScreen.dart'; import 'ModifyPasswordScreen.dart'; @@ -88,6 +89,7 @@ class SettingsScreen extends StatelessWidget { noAnimationSetting(), const Divider(), fullScreenUISetting(), + willPopNoticeSetting(), timeZoneSetting(), const Divider(), autoCleanSecSetting(), diff --git a/lib/screens/ViewLogsScreen.dart b/lib/screens/ViewLogsScreen.dart index c8d18e4..92673b5 100644 --- a/lib/screens/ViewLogsScreen.dart +++ b/lib/screens/ViewLogsScreen.dart @@ -213,6 +213,7 @@ class ViewInfoCard extends StatelessWidget { Container( padding: const EdgeInsets.only(right: 10), child: RemoteImage( + key: Key("$fileServer:$path"), fileServer: fileServer, path: path, width: imageWidth, diff --git a/pubspec.yaml b/pubspec.yaml index 62a650e..0308ef9 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 1.5.7+3 +version: 1.5.8+4 environment: sdk: ">=2.12.0 <3.0.0"