mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 15:24:35 +01:00
Add check update btn in setting
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
|
||||
class BuildData {
|
||||
static const String name = "ToolBox";
|
||||
static const int build = 58;
|
||||
static const int build = 59;
|
||||
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 19:44:10.383544";
|
||||
static const String buildAt = "2021-11-02 20:31:21.141578";
|
||||
static const int modifications = 4;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_material_color_picker/flutter_material_color_picker.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:toolbox/core/update.dart';
|
||||
import 'package:toolbox/data/provider/app.dart';
|
||||
import 'package:toolbox/data/res/build_data.dart';
|
||||
import 'package:toolbox/data/res/color.dart';
|
||||
import 'package:toolbox/data/store/setting.dart';
|
||||
import 'package:toolbox/locator.dart';
|
||||
@@ -40,56 +44,76 @@ class _SettingPageState extends State<SettingPage> {
|
||||
body: ListView(
|
||||
padding: const EdgeInsets.all(17),
|
||||
children: [
|
||||
RoundRectCard(_buildAppColorPreview()),
|
||||
RoundRectCard(
|
||||
ExpansionTile(
|
||||
tilePadding: EdgeInsets.zero,
|
||||
childrenPadding: EdgeInsets.zero,
|
||||
textColor: priColor,
|
||||
title: const Text(
|
||||
'Server status update interval',
|
||||
style: TextStyle(fontSize: 14),
|
||||
textAlign: TextAlign.start,
|
||||
),
|
||||
subtitle: const Text(
|
||||
'Will take effect the next time app launches.',
|
||||
style: TextStyle(color: Colors.grey),
|
||||
),
|
||||
trailing: Text('${_intervalValue.toInt()} s'),
|
||||
children: [
|
||||
Slider(
|
||||
thumbColor: priColor,
|
||||
activeColor: priColor.withOpacity(0.7),
|
||||
min: 0,
|
||||
max: 10,
|
||||
value: _intervalValue,
|
||||
onChanged: (newValue) {
|
||||
setState(() {
|
||||
_intervalValue = newValue;
|
||||
});
|
||||
},
|
||||
onChangeEnd: (val) =>
|
||||
_store.serverStatusUpdateInterval.put(val.toInt()),
|
||||
label: '${_intervalValue.toInt()} seconds',
|
||||
divisions: 10,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 3,
|
||||
),
|
||||
_intervalValue == 0.0
|
||||
? const Text('You set to 0, will not update automatically.')
|
||||
: const SizedBox(),
|
||||
const SizedBox(
|
||||
height: 13,
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
_buildAppColorPreview(),
|
||||
_buildUpdateInterval(),
|
||||
_buildCheckUpdate()
|
||||
].map((e) => RoundRectCard(e)).toList(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildCheckUpdate() {
|
||||
return Consumer<AppProvider>(builder: (_, app, __) {
|
||||
String display;
|
||||
if (app.newestBuild != null) {
|
||||
if (app.newestBuild! > BuildData.build) {
|
||||
display = '发现新版本:${app.newestBuild}';
|
||||
} else {
|
||||
display = '当前版本:${BuildData.build},已是最新';
|
||||
}
|
||||
} else {
|
||||
display = '当前版本:${BuildData.build},点击检查更新';
|
||||
}
|
||||
return ListTile(
|
||||
title: Text(display), onTap: () => doUpdate(context, force: true));
|
||||
});
|
||||
}
|
||||
|
||||
Widget _buildUpdateInterval() {
|
||||
return ExpansionTile(
|
||||
tilePadding: EdgeInsets.zero,
|
||||
childrenPadding: EdgeInsets.zero,
|
||||
textColor: priColor,
|
||||
title: const Text(
|
||||
'Server status update interval',
|
||||
style: TextStyle(fontSize: 14),
|
||||
textAlign: TextAlign.start,
|
||||
),
|
||||
subtitle: const Text(
|
||||
'Will take effect the next time app launches.',
|
||||
style: TextStyle(color: Colors.grey),
|
||||
),
|
||||
trailing: Text('${_intervalValue.toInt()} s'),
|
||||
children: [
|
||||
Slider(
|
||||
thumbColor: priColor,
|
||||
activeColor: priColor.withOpacity(0.7),
|
||||
min: 0,
|
||||
max: 10,
|
||||
value: _intervalValue,
|
||||
onChanged: (newValue) {
|
||||
setState(() {
|
||||
_intervalValue = newValue;
|
||||
});
|
||||
},
|
||||
onChangeEnd: (val) =>
|
||||
_store.serverStatusUpdateInterval.put(val.toInt()),
|
||||
label: '${_intervalValue.toInt()} seconds',
|
||||
divisions: 10,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 3,
|
||||
),
|
||||
_intervalValue == 0.0
|
||||
? const Text('You set to 0, will not update automatically.')
|
||||
: const SizedBox(),
|
||||
const SizedBox(
|
||||
height: 13,
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildAppColorPreview() {
|
||||
return ExpansionTile(
|
||||
textColor: priColor,
|
||||
|
||||
@@ -10,6 +10,6 @@ class SnippetEditPage extends StatefulWidget {
|
||||
class _SnippetEditPageState extends State<SnippetEditPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container();
|
||||
return Scaffold(appBar: AppBar(title: const Text('Snippet Edit'),), body: const Center(child: Text('Developing'),),);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,6 @@ class SnippetListPage extends StatefulWidget {
|
||||
class _SnippetListPageState extends State<SnippetListPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container();
|
||||
return Scaffold(appBar: AppBar(title: const Text('Snippet List'),), body: const Center(child: Text('Developing'),),);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user