Fix update things

This commit is contained in:
LollipopKit
2021-11-02 20:58:50 +08:00
parent 72c1901989
commit 7c34530821
3 changed files with 15 additions and 11 deletions

View File

@@ -39,8 +39,8 @@ Future<void> doUpdate(BuildContext context, {bool force = false}) async {
showSnackBarWithAction(
context,
update.min > BuildData.build
? 'Your version is too old. \nPlease update to v${update.newest}.'
: 'Update: v${update.newest}available. \n${update.changelog}',
? 'Your version is too old. \nPlease update to v1.0.${update.newest}.'
: 'Update: v1.0.${update.newest} available. \n${update.changelog}',
'Update',
() => openUrl(Platform.isAndroid ? update.android : update.ios));
}

View File

@@ -2,8 +2,8 @@
class BuildData {
static const String name = "ToolBox";
static const int build = 59;
static const int build = 60;
static const String engine = "Flutter 2.5.3 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision 18116933e7 (3 weeks ago) • 2021-10-15 10:46:35 -0700\nEngine • revision d3ea636dc5\nTools • Dart 2.14.4\n";
static const String buildAt = "2021-11-02 20:31:21.141578";
static const int modifications = 4;
static const String buildAt = "2021-11-02 20:36:41.010803";
static const int modifications = 2;
}

View File

@@ -21,6 +21,7 @@ class _SettingPageState extends State<SettingPage> {
late int _selectedColorValue;
double _intervalValue = 0;
late Color priColor;
static const textStyle = TextStyle(fontSize: 14);
@override
void didChangeDependencies() {
@@ -57,15 +58,18 @@ class _SettingPageState extends State<SettingPage> {
String display;
if (app.newestBuild != null) {
if (app.newestBuild! > BuildData.build) {
display = '发现新版本:${app.newestBuild}';
display = 'Found: v1.0.${app.newestBuild}, click to update';
} else {
display = '当前版本:${BuildData.build}已是最新';
display = 'Current: v1.0.${BuildData.build}is up to date';
}
} else {
display = '当前版本:${BuildData.build},点击检查更新';
display = 'Current: v1.0.${BuildData.build}';
}
return ListTile(
title: Text(display), onTap: () => doUpdate(context, force: true));
contentPadding: EdgeInsets.zero,
trailing: const Icon(Icons.keyboard_arrow_right),
title: Text(display, style: textStyle,
textAlign: TextAlign.start,), onTap: () => doUpdate(context, force: true));
});
}
@@ -76,7 +80,7 @@ class _SettingPageState extends State<SettingPage> {
textColor: priColor,
title: const Text(
'Server status update interval',
style: TextStyle(fontSize: 14),
style: textStyle,
textAlign: TextAlign.start,
),
subtitle: const Text(
@@ -132,7 +136,7 @@ class _SettingPageState extends State<SettingPage> {
),
title: const Text(
'App primary color',
style: TextStyle(fontSize: 14),
style: textStyle,
));
}