From f7d6c461dc6ec1317dcf79540261a4f54f0f9d8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?lollipopkit=F0=9F=8F=B3=EF=B8=8F=E2=80=8D=E2=9A=A7?= =?UTF-8?q?=EF=B8=8F?= <10864310+lollipopkit@users.noreply.github.com> Date: Wed, 10 Jul 2024 15:12:05 +0800 Subject: [PATCH] fix: version display (#458) Fixes #457 --- .vscode/launch.json | 4 ++++ README.md | 2 +- README_zh.md | 2 +- lib/data/provider/app.dart | 7 ------- lib/view/page/setting/entry.dart | 13 ++++++------- 5 files changed, 12 insertions(+), 16 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index bd32747e5..0f22698a5 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -8,6 +8,10 @@ "name": "debug", "request": "launch", "type": "dart", + "env": { + // Comment this line to use the default display + "DISPLAY": ":1" + } // "args": [ // "-v" // ] diff --git a/README.md b/README.md index a8b251648..707b4dea6 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Especially thanks to dartss Platform | From --- | --- iOS / macOS | [AppStore](https://apps.apple.com/app/id1586449703) -Android | [F-Droid](https://f-droid.org/packages/tech.lolli.toolbox) / [GitHub](https://github.com/lollipopkit/flutter_server_box/releases) / [CDN](https://cdn.lolli.tech/serverbox/?sort=time&order=desc&layout=grid) / [OpenAPK](https://www.openapk.net/serverbox/tech.lolli.toolbox/) +Android | [GitHub](https://github.com/lollipopkit/flutter_server_box/releases) / [CDN](https://cdn.lolli.tech/serverbox/?sort=time&order=desc&layout=grid) / [F-Droid](https://f-droid.org/packages/tech.lolli.toolbox) / [OpenAPK](https://www.openapk.net/serverbox/tech.lolli.toolbox/) Linux / Windows | [GitHub](https://github.com/lollipopkit/flutter_server_box/releases) / [CDN](https://cdn.lolli.tech/serverbox/?sort=time&order=desc&layout=grid) **Please only download pkgs from the source that you trust!** diff --git a/README_zh.md b/README_zh.md index 76ef638ab..523cbc78b 100644 --- a/README_zh.md +++ b/README_zh.md @@ -18,7 +18,7 @@ 平台 | 下载 --- | --- iOS / macOS | [AppStore](https://apps.apple.com/app/id1586449703) -Android | [F-Droid](https://f-droid.org/packages/tech.lolli.toolbox) / [GitHub](https://github.com/lollipopkit/flutter_server_box/releases) / [CDN](https://cdn.lolli.tech/serverbox/?sort=time&order=desc&layout=grid) / [OpenAPK](https://www.openapk.net/serverbox/tech.lolli.toolbox/) +Android | [GitHub](https://github.com/lollipopkit/flutter_server_box/releases) / [CDN](https://cdn.lolli.tech/serverbox/?sort=time&order=desc&layout=grid) / [F-Droid](https://f-droid.org/packages/tech.lolli.toolbox) / [OpenAPK](https://www.openapk.net/serverbox/tech.lolli.toolbox/) Linux / Windows | [GitHub](https://github.com/lollipopkit/flutter_server_box/releases) / [CDN](https://cdn.lolli.tech/serverbox/?sort=time&order=desc&layout=grid) **请不要从不受信任的来源下载!** diff --git a/lib/data/provider/app.dart b/lib/data/provider/app.dart index 50a8fb462..336e47d58 100644 --- a/lib/data/provider/app.dart +++ b/lib/data/provider/app.dart @@ -3,13 +3,6 @@ import 'package:fl_lib/fl_lib.dart'; import 'package:flutter/material.dart'; class AppProvider extends ChangeNotifier { - int? _newestBuild; - int? get newestBuild => _newestBuild; - set newestBuild(int? build) { - _newestBuild = build; - notifyListeners(); - } - BuildContext? ctx; bool isWearOS = false; diff --git a/lib/view/page/setting/entry.dart b/lib/view/page/setting/entry.dart index 938f881db..41a6be7b2 100644 --- a/lib/view/page/setting/entry.dart +++ b/lib/view/page/setting/entry.dart @@ -5,7 +5,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_highlight/theme_map.dart'; import 'package:flutter_gen/gen_l10n/l10n.dart'; import 'package:icons_plus/icons_plus.dart'; -import 'package:provider/provider.dart'; import 'package:server_box/core/extension/context/locale.dart'; import 'package:server_box/data/res/rebuild.dart'; import 'package:server_box/data/res/store.dart'; @@ -14,7 +13,6 @@ import 'package:server_box/view/page/setting/platform/platform_pub.dart'; import '../../../core/route.dart'; import '../../../data/model/app/net_view.dart'; -import '../../../data/provider/app.dart'; import '../../../data/res/build_data.dart'; const _kIconSize = 23.0; @@ -184,12 +182,13 @@ class _SettingPageState extends State { return ListTile( leading: const Icon(Icons.update), title: Text(l10n.autoCheckUpdate), - subtitle: Consumer( - builder: (ctx, app, __) { + subtitle: ValBuilder( + listenable: AppUpdateIface.newestBuild, + builder: (val) { String display; - if (app.newestBuild != null) { - if (app.newestBuild! > BuildData.build) { - display = l10n.versionHaveUpdate(app.newestBuild!); + if (val != null) { + if (val > BuildData.build) { + display = l10n.versionHaveUpdate(val); } else { display = l10n.versionUpdated(BuildData.build); }