mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2026-02-15 12:44:59 +01:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7c34530821 | ||
|
|
72c1901989 | ||
|
|
ff76c6c539 |
15
README.md
15
README.md
@@ -31,15 +31,16 @@ A new Flutter project which provide a chart view to display server status data.
|
||||
</table>
|
||||
|
||||
## Milestone
|
||||
- [x] SSH Connect
|
||||
- [x] Server Info Store
|
||||
- [x] Status Chart View
|
||||
- [x] SSH connect
|
||||
- [x] Server info store
|
||||
- [x] Status chart view
|
||||
- [x] Base64/Url En/Decode
|
||||
- [x] Private Key Store
|
||||
- [x] Server Status Detail Page
|
||||
- [x] Theme Switch
|
||||
- [ ] Execute Snippet
|
||||
- [x] Private key store
|
||||
- [x] Server status detail page
|
||||
- [x] Theme switch
|
||||
- [ ] Execute snippet
|
||||
- [ ] Migrate from `ssh2` to `dartssh2`
|
||||
- [ ] Desktop support.
|
||||
|
||||
## Build
|
||||
Please use `make.dart` to build.
|
||||
|
||||
@@ -2,7 +2,10 @@
|
||||
package="tech.lolli.toolbox">
|
||||
<application
|
||||
android:label="ServerBox"
|
||||
android:icon="@mipmap/ic_launcher">
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:allowBackup="true"
|
||||
android:hasFragileUserData="true"
|
||||
android:restoreAnyVersion="true">
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:launchMode="singleTop"
|
||||
|
||||
@@ -39,8 +39,8 @@ Future<void> doUpdate(BuildContext context, {bool force = false}) async {
|
||||
showSnackBarWithAction(
|
||||
context,
|
||||
update.min > BuildData.build
|
||||
? '您的版本过旧,请及时更新'
|
||||
: '${BuildData.name}有更新啦,Ver:${update.newest}\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));
|
||||
}
|
||||
|
||||
@@ -2,9 +2,8 @@
|
||||
|
||||
class BuildData {
|
||||
static const String name = "ToolBox";
|
||||
static const int build = 55;
|
||||
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 15:32:29.280614";
|
||||
static const int modifications = 1;
|
||||
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:36:41.010803";
|
||||
static const int modifications = 2;
|
||||
}
|
||||
|
||||
@@ -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';
|
||||
@@ -17,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() {
|
||||
@@ -40,56 +45,79 @@ 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 = 'Found: v1.0.${app.newestBuild}, click to update';
|
||||
} else {
|
||||
display = 'Current: v1.0.${BuildData.build},is up to date';
|
||||
}
|
||||
} else {
|
||||
display = 'Current: v1.0.${BuildData.build}';
|
||||
}
|
||||
return ListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
trailing: const Icon(Icons.keyboard_arrow_right),
|
||||
title: Text(display, style: textStyle,
|
||||
textAlign: TextAlign.start,), 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,
|
||||
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,
|
||||
@@ -108,7 +136,7 @@ class _SettingPageState extends State<SettingPage> {
|
||||
),
|
||||
title: const Text(
|
||||
'App primary color',
|
||||
style: TextStyle(fontSize: 14),
|
||||
style: textStyle,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@@ -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