Compare commits
38 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1184841c24 | ||
|
|
02a8a38a0a | ||
|
|
d70cbb66d2 | ||
|
|
4636219b6a | ||
|
|
b7b8d33bd9 | ||
|
|
10c874e7d4 | ||
|
|
5bf5a4b67e | ||
|
|
1bd43829bb | ||
|
|
026d203608 | ||
|
|
5d9b19407f | ||
|
|
86be556a22 | ||
|
|
e65d30590a | ||
|
|
86a700d0bb | ||
|
|
db3ec38a0f | ||
|
|
a58119ef54 | ||
|
|
340a7641e6 | ||
|
|
4d227c3f00 | ||
|
|
195e188d0c | ||
|
|
692f3bcdbc | ||
|
|
516cec5565 | ||
|
|
5a706313f5 | ||
|
|
937f2fb38f | ||
|
|
7e36c06542 | ||
|
|
317936c521 | ||
|
|
a2ed889183 | ||
|
|
3fc43d06e9 | ||
|
|
b922428c40 | ||
|
|
e08f37fedc | ||
|
|
7fb8c88ab8 | ||
|
|
f480c49f1f | ||
|
|
f7558d6beb | ||
|
|
de1e970108 | ||
|
|
9ef59f4c12 | ||
|
|
89ef2cb95c | ||
|
|
e0fb591dea | ||
|
|
7c34530821 | ||
|
|
72c1901989 | ||
|
|
ff76c6c539 |
6
.vscode/launch.json
vendored
@@ -13,7 +13,11 @@
|
|||||||
"name": "toolbox (profile mode)",
|
"name": "toolbox (profile mode)",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"type": "dart",
|
"type": "dart",
|
||||||
"flutterMode": "profile"
|
"flutterMode": "profile",
|
||||||
|
"args": [
|
||||||
|
"--cache-sksl",
|
||||||
|
// "--purge-persistent-cache"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
52
README.md
@@ -1,55 +1,69 @@
|
|||||||
# Server Monitor & Toolbox
|
# Server Monitor & Toolbox
|
||||||
|
|
||||||
A new Flutter project which provide a chart view to display server status data.
|
A new Flutter project which provide a chart view to display server status data and a manager toolbox.
|
||||||
|
|
||||||
## ScreenShots
|
## ScreenShots
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<img width="200px" src="https://raw.githubusercontent.com/LollipopKit/flutter_server_monitor_toolbox/main/screenshots/IMG_3327.PNG">
|
<img width="200px" src="https://raw.githubusercontent.com/LollipopKit/flutter_server_monitor_toolbox/main/screenshots/server.jpg">
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<img width="200px" src="https://raw.githubusercontent.com/LollipopKit/flutter_server_monitor_toolbox/main/screenshots/IMG_3347.PNG">
|
<img width="200px" src="https://raw.githubusercontent.com/LollipopKit/flutter_server_monitor_toolbox/main/screenshots/server_detail.jpg">
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<img width="200px" src="https://raw.githubusercontent.com/LollipopKit/flutter_server_monitor_toolbox/main/screenshots/detail.jpg">
|
<img width="200px" src="https://raw.githubusercontent.com/LollipopKit/flutter_server_monitor_toolbox/main/screenshots/server_edit.jpg">
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<img width="200px" src="https://raw.githubusercontent.com/LollipopKit/flutter_server_monitor_toolbox/main/screenshots/IMG_3330.PNG">
|
<img width="200px" src="https://raw.githubusercontent.com/LollipopKit/flutter_server_monitor_toolbox/main/screenshots/convert.jpg">
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<img width="200px" src="https://raw.githubusercontent.com/LollipopKit/flutter_server_monitor_toolbox/main/screenshots/IMG_3331.PNG">
|
<img width="200px" src="https://raw.githubusercontent.com/LollipopKit/flutter_server_monitor_toolbox/main/screenshots/ping.jpg">
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<img width="200px" src="https://raw.githubusercontent.com/LollipopKit/flutter_server_monitor_toolbox/main/screenshots/IMG_3346.PNG">
|
<img width="200px" src="https://raw.githubusercontent.com/LollipopKit/flutter_server_monitor_toolbox/main/screenshots/setting.jpg">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<img width="200px" src="https://raw.githubusercontent.com/LollipopKit/flutter_server_monitor_toolbox/main/screenshots/drawer.jpg">
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
# Support
|
||||||
|
Status|Platform
|
||||||
|
--|--|
|
||||||
|
Full Support|Android/iOS/macOS
|
||||||
|
Support, but not tested|Windows/Linux
|
||||||
|
|
||||||
## Milestone
|
## Milestone
|
||||||
- [x] SSH Connect
|
- [x] SSH connect
|
||||||
- [x] Server Info Store
|
- [x] Server info store
|
||||||
- [x] Status Chart View
|
- [x] Status chart view
|
||||||
- [x] Base64/Url En/Decode
|
- [x] Base64/Url En/Decode
|
||||||
- [x] Private Key Store
|
- [x] Server status detail page
|
||||||
- [x] Server Status Detail Page
|
- [x] Theme switch
|
||||||
- [x] Theme Switch
|
- [x] Migrate from `ssh2` to `dartssh2`
|
||||||
- [ ] Execute Snippet
|
- [x] Desktop support
|
||||||
- [ ] Migrate from `ssh2` to `dartssh2`
|
- [ ] Apt manager
|
||||||
|
- [ ] SFTP
|
||||||
|
- [ ] Snippet market
|
||||||
|
- [ ] Docker manager
|
||||||
|
- [ ] SSH terminal
|
||||||
|
|
||||||
## Build
|
## Build
|
||||||
Please use `make.dart` to build.
|
Please use `make.dart` to build.
|
||||||
```shell
|
```shell
|
||||||
# build android apk
|
# build android apk
|
||||||
./make.dart build android
|
./make.dart build android
|
||||||
# due to pub package 'ssh2' incompatibility
|
# Run in release mode
|
||||||
# can't build ios ipa through './make.dart build ios'
|
|
||||||
# more info: [https://github.com/jda258/flutter_ssh2/issues/8]
|
|
||||||
# please run below cmd to run on ios device
|
|
||||||
./make.dart run release
|
./make.dart run release
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ apply plugin: 'kotlin-android'
|
|||||||
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 30
|
compileSdkVersion 31
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility JavaVersion.VERSION_1_8
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||||||
|
|||||||
@@ -1,8 +1,16 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="tech.lolli.toolbox">
|
package="tech.lolli.toolbox">
|
||||||
<application
|
|
||||||
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||||
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
|
|
||||||
|
<application
|
||||||
android:label="ServerBox"
|
android:label="ServerBox"
|
||||||
android:icon="@mipmap/ic_launcher">
|
android:icon="@mipmap/ic_launcher"
|
||||||
|
android:allowBackup="true"
|
||||||
|
android:hasFragileUserData="true"
|
||||||
|
android:restoreAnyVersion="true">
|
||||||
<activity
|
<activity
|
||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
android:launchMode="singleTop"
|
android:launchMode="singleTop"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '1.3.50'
|
ext.kotlin_version = '1.6.10'
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
|||||||
@@ -2,45 +2,44 @@ PODS:
|
|||||||
- countly_flutter (20.11.4):
|
- countly_flutter (20.11.4):
|
||||||
- Flutter
|
- Flutter
|
||||||
- Flutter (1.0.0)
|
- Flutter (1.0.0)
|
||||||
- GZ-NMSSH (4.1.5)
|
- flutter_icmp_ping (0.0.1):
|
||||||
- path_provider (0.0.1):
|
|
||||||
- Flutter
|
- Flutter
|
||||||
- ssh2 (2.2.3):
|
- path_provider_ios (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
- GZ-NMSSH (~> 4.1.5)
|
- r_upgrade (0.0.1):
|
||||||
- url_launcher (0.0.1):
|
- Flutter
|
||||||
|
- url_launcher_ios (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
|
|
||||||
DEPENDENCIES:
|
DEPENDENCIES:
|
||||||
- countly_flutter (from `.symlinks/plugins/countly_flutter/ios`)
|
- countly_flutter (from `.symlinks/plugins/countly_flutter/ios`)
|
||||||
- Flutter (from `Flutter`)
|
- Flutter (from `Flutter`)
|
||||||
- path_provider (from `.symlinks/plugins/path_provider/ios`)
|
- flutter_icmp_ping (from `.symlinks/plugins/flutter_icmp_ping/ios`)
|
||||||
- ssh2 (from `.symlinks/plugins/ssh2/ios`)
|
- path_provider_ios (from `.symlinks/plugins/path_provider_ios/ios`)
|
||||||
- url_launcher (from `.symlinks/plugins/url_launcher/ios`)
|
- r_upgrade (from `.symlinks/plugins/r_upgrade/ios`)
|
||||||
|
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
|
||||||
SPEC REPOS:
|
|
||||||
trunk:
|
|
||||||
- GZ-NMSSH
|
|
||||||
|
|
||||||
EXTERNAL SOURCES:
|
EXTERNAL SOURCES:
|
||||||
countly_flutter:
|
countly_flutter:
|
||||||
:path: ".symlinks/plugins/countly_flutter/ios"
|
:path: ".symlinks/plugins/countly_flutter/ios"
|
||||||
Flutter:
|
Flutter:
|
||||||
:path: Flutter
|
:path: Flutter
|
||||||
path_provider:
|
flutter_icmp_ping:
|
||||||
:path: ".symlinks/plugins/path_provider/ios"
|
:path: ".symlinks/plugins/flutter_icmp_ping/ios"
|
||||||
ssh2:
|
path_provider_ios:
|
||||||
:path: ".symlinks/plugins/ssh2/ios"
|
:path: ".symlinks/plugins/path_provider_ios/ios"
|
||||||
url_launcher:
|
r_upgrade:
|
||||||
:path: ".symlinks/plugins/url_launcher/ios"
|
:path: ".symlinks/plugins/r_upgrade/ios"
|
||||||
|
url_launcher_ios:
|
||||||
|
:path: ".symlinks/plugins/url_launcher_ios/ios"
|
||||||
|
|
||||||
SPEC CHECKSUMS:
|
SPEC CHECKSUMS:
|
||||||
countly_flutter: 38419412e193a1faa5babeb5d28a63fda260687d
|
countly_flutter: 38419412e193a1faa5babeb5d28a63fda260687d
|
||||||
Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a
|
Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a
|
||||||
GZ-NMSSH: d749f8ae2fd0094b953cd1d5abd8e0cab3c93f8d
|
flutter_icmp_ping: 07e508847df7fa9262d050bb0b203de074bbe517
|
||||||
path_provider: d1e9807085df1f9cc9318206cd649dc0b76be3de
|
path_provider_ios: 7d7ce634493af4477d156294792024ec3485acd5
|
||||||
ssh2: 74165efc99417a075ecafd52caf93edadfb5eb60
|
r_upgrade: 44d715c61914cce3d01ea225abffe894fd51c114
|
||||||
url_launcher: b6e016d912f04be9f5bf6e8e82dc599b7ba59649
|
url_launcher_ios: 02f1989d4e14e998335b02b67a7590fa34f971af
|
||||||
|
|
||||||
PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c
|
PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c
|
||||||
|
|
||||||
|
|||||||
@@ -155,7 +155,7 @@
|
|||||||
97C146E61CF9000F007C117D /* Project object */ = {
|
97C146E61CF9000F007C117D /* Project object */ = {
|
||||||
isa = PBXProject;
|
isa = PBXProject;
|
||||||
attributes = {
|
attributes = {
|
||||||
LastUpgradeCheck = 1020;
|
LastUpgradeCheck = 1300;
|
||||||
ORGANIZATIONNAME = "";
|
ORGANIZATIONNAME = "";
|
||||||
TargetAttributes = {
|
TargetAttributes = {
|
||||||
97C146ED1CF9000F007C117D = {
|
97C146ED1CF9000F007C117D = {
|
||||||
@@ -354,7 +354,7 @@
|
|||||||
buildSettings = {
|
buildSettings = {
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
CURRENT_PROJECT_VERSION = 88;
|
||||||
DEVELOPMENT_TEAM = BA88US33G6;
|
DEVELOPMENT_TEAM = BA88US33G6;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
INFOPLIST_FILE = Runner/Info.plist;
|
INFOPLIST_FILE = Runner/Info.plist;
|
||||||
@@ -362,7 +362,8 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = tech.lolli.toolbox;
|
MARKETING_VERSION = 1.0.88;
|
||||||
|
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||||
SWIFT_VERSION = 5.0;
|
SWIFT_VERSION = 5.0;
|
||||||
@@ -483,7 +484,7 @@
|
|||||||
buildSettings = {
|
buildSettings = {
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
CURRENT_PROJECT_VERSION = 88;
|
||||||
DEVELOPMENT_TEAM = BA88US33G6;
|
DEVELOPMENT_TEAM = BA88US33G6;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
INFOPLIST_FILE = Runner/Info.plist;
|
INFOPLIST_FILE = Runner/Info.plist;
|
||||||
@@ -491,7 +492,8 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = tech.lolli.toolbox;
|
MARKETING_VERSION = 1.0.88;
|
||||||
|
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||||
@@ -506,7 +508,7 @@
|
|||||||
buildSettings = {
|
buildSettings = {
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
CURRENT_PROJECT_VERSION = 88;
|
||||||
DEVELOPMENT_TEAM = BA88US33G6;
|
DEVELOPMENT_TEAM = BA88US33G6;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
INFOPLIST_FILE = Runner/Info.plist;
|
INFOPLIST_FILE = Runner/Info.plist;
|
||||||
@@ -514,7 +516,8 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = tech.lolli.toolbox;
|
MARKETING_VERSION = 1.0.88;
|
||||||
|
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||||
SWIFT_VERSION = 5.0;
|
SWIFT_VERSION = 5.0;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<Scheme
|
<Scheme
|
||||||
LastUpgradeVersion = "1020"
|
LastUpgradeVersion = "1300"
|
||||||
version = "1.3">
|
version = "1.3">
|
||||||
<BuildAction
|
<BuildAction
|
||||||
parallelizeBuildables = "YES"
|
parallelizeBuildables = "YES"
|
||||||
|
|||||||
@@ -1,45 +1,45 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
<key>CFBundleDevelopmentRegion</key>
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||||
<key>CFBundleExecutable</key>
|
<key>CFBundleExecutable</key>
|
||||||
<string>$(EXECUTABLE_NAME)</string>
|
<string>$(EXECUTABLE_NAME)</string>
|
||||||
<key>CFBundleIdentifier</key>
|
<key>CFBundleIdentifier</key>
|
||||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||||
<key>CFBundleInfoDictionaryVersion</key>
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
<string>6.0</string>
|
<string>6.0</string>
|
||||||
<key>CFBundleName</key>
|
<key>CFBundleName</key>
|
||||||
<string>toolbox</string>
|
<string>ServerBox</string>
|
||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>APPL</string>
|
<string>APPL</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>$(FLUTTER_BUILD_NAME)</string>
|
<string>$(MARKETING_VERSION)</string>
|
||||||
<key>CFBundleSignature</key>
|
<key>CFBundleSignature</key>
|
||||||
<string>????</string>
|
<string>????</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>$(FLUTTER_BUILD_NUMBER)</string>
|
<string>$(CURRENT_PROJECT_VERSION)</string>
|
||||||
<key>LSRequiresIPhoneOS</key>
|
<key>LSRequiresIPhoneOS</key>
|
||||||
<true/>
|
<true/>
|
||||||
<key>UILaunchStoryboardName</key>
|
<key>UILaunchStoryboardName</key>
|
||||||
<string>LaunchScreen</string>
|
<string>LaunchScreen</string>
|
||||||
<key>UIMainStoryboardFile</key>
|
<key>UIMainStoryboardFile</key>
|
||||||
<string>Main</string>
|
<string>Main</string>
|
||||||
<key>UISupportedInterfaceOrientations</key>
|
<key>UIStatusBarHidden</key>
|
||||||
<array>
|
<false/>
|
||||||
<string>UIInterfaceOrientationPortrait</string>
|
<key>UISupportedInterfaceOrientations</key>
|
||||||
</array>
|
<array>
|
||||||
<key>UISupportedInterfaceOrientations~ipad</key>
|
<string>UIInterfaceOrientationPortrait</string>
|
||||||
<array>
|
</array>
|
||||||
<string>UIInterfaceOrientationPortrait</string>
|
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
<array>
|
||||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
<string>UIInterfaceOrientationPortrait</string>
|
||||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||||
</array>
|
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||||
<key>UIViewControllerBasedStatusBarAppearance</key>
|
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||||
<false/>
|
</array>
|
||||||
<key>UIStatusBarHidden</key>
|
<key>UIViewControllerBasedStatusBarAppearance</key>
|
||||||
<false/>
|
<false/>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:toolbox/data/res/build_data.dart';
|
||||||
import 'package:toolbox/data/store/setting.dart';
|
import 'package:toolbox/data/store/setting.dart';
|
||||||
import 'package:toolbox/locator.dart';
|
import 'package:toolbox/locator.dart';
|
||||||
import 'package:toolbox/view/page/home.dart';
|
import 'package:toolbox/view/page/home.dart';
|
||||||
@@ -21,7 +22,6 @@ class MyApp extends StatelessWidget {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// This widget is the root of your application.
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return ValueListenableBuilder<int>(
|
return ValueListenableBuilder<int>(
|
||||||
@@ -30,7 +30,8 @@ class MyApp extends StatelessWidget {
|
|||||||
final primaryColor = Color(value);
|
final primaryColor = Color(value);
|
||||||
final textStyle = TextStyle(color: primaryColor);
|
final textStyle = TextStyle(color: primaryColor);
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
title: 'ToolBox',
|
title: BuildData.name,
|
||||||
|
debugShowCheckedModeBanner: false,
|
||||||
theme: ThemeData(
|
theme: ThemeData(
|
||||||
primaryColor: primaryColor,
|
primaryColor: primaryColor,
|
||||||
appBarTheme: AppBarTheme(backgroundColor: primaryColor),
|
appBarTheme: AppBarTheme(backgroundColor: primaryColor),
|
||||||
|
|||||||
@@ -6,7 +6,10 @@ class Analysis {
|
|||||||
static const _url = 'https://countly.xuty.cc';
|
static const _url = 'https://countly.xuty.cc';
|
||||||
static const _key = '80372a2a66424b32d0ac8991bfa1ef058bd36b1f';
|
static const _key = '80372a2a66424b32d0ac8991bfa1ef058bd36b1f';
|
||||||
|
|
||||||
|
static bool _enabled = false;
|
||||||
|
|
||||||
static Future<void> init(bool debug) async {
|
static Future<void> init(bool debug) async {
|
||||||
|
_enabled = true;
|
||||||
await Countly.setLoggingEnabled(debug);
|
await Countly.setLoggingEnabled(debug);
|
||||||
await Countly.init(_url, _key);
|
await Countly.init(_url, _key);
|
||||||
await Countly.start();
|
await Countly.start();
|
||||||
@@ -15,10 +18,14 @@ class Analysis {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void recordView(String view) {
|
static void recordView(String view) {
|
||||||
Countly.recordView(view);
|
if (_enabled) {
|
||||||
|
Countly.recordView(view);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void recordException(Object exception, [bool fatal = false]) {
|
static void recordException(Object exception, [bool fatal = false]) {
|
||||||
Countly.logException(exception.toString(), !fatal, null);
|
if (_enabled) {
|
||||||
|
Countly.logException(exception.toString(), !fatal, null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import 'dart:io';
|
|||||||
|
|
||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:r_upgrade/r_upgrade.dart';
|
||||||
import 'package:toolbox/core/utils.dart';
|
import 'package:toolbox/core/utils.dart';
|
||||||
import 'package:toolbox/data/provider/app.dart';
|
import 'package:toolbox/data/provider/app.dart';
|
||||||
import 'package:toolbox/data/res/build_data.dart';
|
import 'package:toolbox/data/res/build_data.dart';
|
||||||
@@ -39,8 +40,16 @@ Future<void> doUpdate(BuildContext context, {bool force = false}) async {
|
|||||||
showSnackBarWithAction(
|
showSnackBarWithAction(
|
||||||
context,
|
context,
|
||||||
update.min > BuildData.build
|
update.min > BuildData.build
|
||||||
? '您的版本过旧,请及时更新'
|
? 'Your version is too old. \nPlease update to v1.0.${update.newest}.'
|
||||||
: '${BuildData.name}有更新啦,Ver:${update.newest}\n${update.changelog}',
|
: 'Update: v1.0.${update.newest} available. \n${update.changelog}',
|
||||||
'更新',
|
'Update', () async {
|
||||||
() => openUrl(Platform.isAndroid ? update.android : update.ios));
|
if (Platform.isAndroid) {
|
||||||
|
await RUpgrade.upgrade(update.android,
|
||||||
|
fileName: update.android.split('/').last, isAutoRequestInstall: true);
|
||||||
|
} else if (Platform.isIOS) {
|
||||||
|
await RUpgrade.upgradeFromAppStore('1586449703');
|
||||||
|
} else if (Platform.isMacOS) {
|
||||||
|
await RUpgrade.upgradeFromUrl(update.mac);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,13 +15,13 @@ bool isDarkMode(BuildContext context) =>
|
|||||||
void showSnackBar(BuildContext context, Widget child) =>
|
void showSnackBar(BuildContext context, Widget child) =>
|
||||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: child));
|
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: child));
|
||||||
|
|
||||||
void showSnackBarWithAction(
|
void showSnackBarWithAction(BuildContext context, String content, String action,
|
||||||
BuildContext context, String content, String action, Function onTap) {
|
GestureTapCallback onTap) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
|
||||||
content: Text(content),
|
content: Text(content),
|
||||||
action: SnackBarAction(
|
action: SnackBarAction(
|
||||||
label: action,
|
label: action,
|
||||||
onPressed: () => onTap,
|
onPressed: onTap,
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|||||||
35
lib/data/model/app/menu_item.dart
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class MenuItem {
|
||||||
|
final String text;
|
||||||
|
final IconData icon;
|
||||||
|
|
||||||
|
const MenuItem({
|
||||||
|
required this.text,
|
||||||
|
required this.icon,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
class MenuItems {
|
||||||
|
static const List<MenuItem> firstItems = [sftp, snippet, apt];
|
||||||
|
static const List<MenuItem> secondItems = [edit];
|
||||||
|
|
||||||
|
static const sftp = MenuItem(text: 'SFTP', icon: Icons.file_present);
|
||||||
|
static const snippet = MenuItem(text: 'Snippet', icon: Icons.label);
|
||||||
|
static const apt = MenuItem(text: 'Apt', icon: Icons.system_security_update);
|
||||||
|
static const edit = MenuItem(text: 'Edit', icon: Icons.settings);
|
||||||
|
|
||||||
|
static Widget buildItem(MenuItem item) {
|
||||||
|
return Row(
|
||||||
|
children: [
|
||||||
|
Icon(item.icon),
|
||||||
|
const SizedBox(
|
||||||
|
width: 10,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
item.text,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
8
lib/data/model/app/navigation_item.dart
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class NavigationItem {
|
||||||
|
final IconData icon;
|
||||||
|
final String title;
|
||||||
|
|
||||||
|
NavigationItem(this.icon, this.title);
|
||||||
|
}
|
||||||
@@ -13,8 +13,12 @@ class AppUpdate {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
late int newest;
|
late int newest;
|
||||||
|
late int iosbuild;
|
||||||
|
late int androidbuild;
|
||||||
|
late int macbuild;
|
||||||
late String android;
|
late String android;
|
||||||
late String ios;
|
late String ios;
|
||||||
|
late String mac;
|
||||||
late int min;
|
late int min;
|
||||||
late String changelog;
|
late String changelog;
|
||||||
|
|
||||||
@@ -27,6 +31,9 @@ class AppUpdate {
|
|||||||
});
|
});
|
||||||
AppUpdate.fromJson(Map<String, dynamic> json) {
|
AppUpdate.fromJson(Map<String, dynamic> json) {
|
||||||
newest = json["newest"]?.toInt();
|
newest = json["newest"]?.toInt();
|
||||||
|
newest = json["macbuild"]?.toInt();
|
||||||
|
newest = json["iosbuild"]?.toInt();
|
||||||
|
newest = json["androidbuild"]?.toInt();
|
||||||
android = json["android"].toString();
|
android = json["android"].toString();
|
||||||
ios = json["ios"].toString();
|
ios = json["ios"].toString();
|
||||||
min = json["min"].toInt();
|
min = json["min"].toInt();
|
||||||
@@ -35,6 +42,9 @@ class AppUpdate {
|
|||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final Map<String, dynamic> data = <String, dynamic>{};
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
data["newest"] = newest;
|
data["newest"] = newest;
|
||||||
|
data["macbuild"] = macbuild;
|
||||||
|
data["iosbuild"] = iosbuild;
|
||||||
|
data["androidbuild"] = androidbuild;
|
||||||
data["android"] = android;
|
data["android"] = android;
|
||||||
data["ios"] = ios;
|
data["ios"] = ios;
|
||||||
data["min"] = min;
|
data["min"] = min;
|
||||||
|
|||||||
@@ -5,5 +5,11 @@ class Memory {
|
|||||||
int shared;
|
int shared;
|
||||||
int cache;
|
int cache;
|
||||||
int avail;
|
int avail;
|
||||||
Memory({required this.total, required this.used, required this.free, required this.shared, required this.cache, required this.avail});
|
Memory(
|
||||||
|
{required this.total,
|
||||||
|
required this.used,
|
||||||
|
required this.free,
|
||||||
|
required this.shared,
|
||||||
|
required this.cache,
|
||||||
|
required this.avail});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import 'package:ssh2/ssh2.dart';
|
import 'package:dartssh2/dartssh2.dart';
|
||||||
import 'package:toolbox/data/model/server/server_connection_state.dart';
|
import 'package:toolbox/data/model/server/server_connection_state.dart';
|
||||||
import 'package:toolbox/data/model/server/server_private_info.dart';
|
import 'package:toolbox/data/model/server/server_private_info.dart';
|
||||||
import 'package:toolbox/data/model/server/server_status.dart';
|
import 'package:toolbox/data/model/server/server_status.dart';
|
||||||
@@ -6,7 +6,7 @@ import 'package:toolbox/data/model/server/server_status.dart';
|
|||||||
class ServerInfo {
|
class ServerInfo {
|
||||||
ServerPrivateInfo info;
|
ServerPrivateInfo info;
|
||||||
ServerStatus status;
|
ServerStatus status;
|
||||||
SSHClient client;
|
SSHClient? client;
|
||||||
ServerConnectionState connectionState;
|
ServerConnectionState connectionState;
|
||||||
|
|
||||||
ServerInfo(this.info, this.status, this.client, this.connectionState);
|
ServerInfo(this.info, this.status, this.client, this.connectionState);
|
||||||
|
|||||||
@@ -37,7 +37,9 @@ class ServerStatus {
|
|||||||
List<DiskInfo> disk;
|
List<DiskInfo> disk;
|
||||||
TcpStatus tcp;
|
TcpStatus tcp;
|
||||||
NetSpeed netSpeed;
|
NetSpeed netSpeed;
|
||||||
|
String? failedInfo;
|
||||||
|
|
||||||
ServerStatus(this.cpu2Status, this.memory, this.sysVer, this.uptime,
|
ServerStatus(this.cpu2Status, this.memory, this.sysVer, this.uptime,
|
||||||
this.disk, this.tcp, this.netSpeed);
|
this.disk, this.tcp, this.netSpeed,
|
||||||
|
{this.failedInfo});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:dartssh2/dartssh2.dart';
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:logging/logging.dart';
|
import 'package:logging/logging.dart';
|
||||||
import 'package:ssh2/ssh2.dart';
|
|
||||||
import 'package:toolbox/core/extension/stringx.dart';
|
import 'package:toolbox/core/extension/stringx.dart';
|
||||||
import 'package:toolbox/core/provider_base.dart';
|
import 'package:toolbox/core/provider_base.dart';
|
||||||
import 'package:toolbox/data/model/server/cpu_2_status.dart';
|
import 'package:toolbox/data/model/server/cpu_2_status.dart';
|
||||||
@@ -13,15 +15,26 @@ import 'package:toolbox/data/model/server/disk_info.dart';
|
|||||||
import 'package:toolbox/data/model/server/server.dart';
|
import 'package:toolbox/data/model/server/server.dart';
|
||||||
import 'package:toolbox/data/model/server/server_private_info.dart';
|
import 'package:toolbox/data/model/server/server_private_info.dart';
|
||||||
import 'package:toolbox/data/model/server/server_status.dart';
|
import 'package:toolbox/data/model/server/server_status.dart';
|
||||||
|
import 'package:toolbox/data/model/server/snippet.dart';
|
||||||
import 'package:toolbox/data/model/server/tcp_status.dart';
|
import 'package:toolbox/data/model/server/tcp_status.dart';
|
||||||
|
import 'package:toolbox/data/store/private_key.dart';
|
||||||
import 'package:toolbox/data/store/server.dart';
|
import 'package:toolbox/data/store/server.dart';
|
||||||
import 'package:toolbox/data/store/setting.dart';
|
import 'package:toolbox/data/store/setting.dart';
|
||||||
import 'package:toolbox/locator.dart';
|
import 'package:toolbox/locator.dart';
|
||||||
|
|
||||||
|
/// Must put this func out of any Class.
|
||||||
|
/// Because of this function is called by [compute] in [ServerProvider.genClient].
|
||||||
|
/// https://stackoverflow.com/questions/51998995/invalid-arguments-illegal-argument-in-isolate-message-object-is-a-closure
|
||||||
|
List<SSHKeyPair> loadIndentity(String key) {
|
||||||
|
return SSHKeyPair.fromPem(key);
|
||||||
|
}
|
||||||
|
|
||||||
class ServerProvider extends BusyProvider {
|
class ServerProvider extends BusyProvider {
|
||||||
List<ServerInfo> _servers = [];
|
List<ServerInfo> _servers = [];
|
||||||
List<ServerInfo> get servers => _servers;
|
List<ServerInfo> get servers => _servers;
|
||||||
|
|
||||||
|
Timer? _timer;
|
||||||
|
|
||||||
final logger = Logger('ServerProvider');
|
final logger = Logger('ServerProvider');
|
||||||
|
|
||||||
Memory get emptyMemory =>
|
Memory get emptyMemory =>
|
||||||
@@ -56,37 +69,35 @@ class ServerProvider extends BusyProvider {
|
|||||||
|
|
||||||
ServerInfo genInfo(ServerPrivateInfo spi) {
|
ServerInfo genInfo(ServerPrivateInfo spi) {
|
||||||
return ServerInfo(
|
return ServerInfo(
|
||||||
spi, emptyStatus, genClient(spi), ServerConnectionState.disconnected);
|
spi, emptyStatus, null, ServerConnectionState.disconnected);
|
||||||
}
|
}
|
||||||
|
|
||||||
SSHClient genClient(ServerPrivateInfo spi) {
|
Future<SSHClient> genClient(ServerPrivateInfo spi) async {
|
||||||
return SSHClient(
|
final socket = await SSHSocket.connect(spi.ip, spi.port);
|
||||||
host: spi.ip,
|
if (spi.pubKeyId == null) {
|
||||||
port: spi.port,
|
return SSHClient(socket,
|
||||||
|
username: spi.user,
|
||||||
|
onPasswordRequest: () => spi.authorization as String);
|
||||||
|
}
|
||||||
|
final key = locator<PrivateKeyStore>().get(spi.pubKeyId!);
|
||||||
|
return SSHClient(socket,
|
||||||
username: spi.user,
|
username: spi.user,
|
||||||
passwordOrKey: spi.authorization);
|
identities: await compute(loadIndentity, key.privateKey));
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> refreshData({int? idx}) async {
|
Future<void> refreshData({ServerPrivateInfo? spi}) async {
|
||||||
if (idx != null) {
|
if (spi != null) {
|
||||||
final singleData = await _getData(_servers[idx].info, idx);
|
_getData(spi);
|
||||||
if (singleData != null) {
|
|
||||||
_servers[idx].status = singleData;
|
|
||||||
notifyListeners();
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
await Future.wait(_servers.map((s) async {
|
await Future.wait(_servers.map((s) async {
|
||||||
final idx = _servers.indexOf(s);
|
await _getData(s.info);
|
||||||
final status = await _getData(s.info, idx);
|
|
||||||
if (status != null) {
|
|
||||||
_servers[idx].status = status;
|
|
||||||
notifyListeners();
|
|
||||||
}
|
|
||||||
}));
|
}));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
rethrow;
|
if (e is! RangeError) {
|
||||||
|
rethrow;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,83 +105,94 @@ class ServerProvider extends BusyProvider {
|
|||||||
final duration =
|
final duration =
|
||||||
locator<SettingStore>().serverStatusUpdateInterval.fetch()!;
|
locator<SettingStore>().serverStatusUpdateInterval.fetch()!;
|
||||||
if (duration == 0) return;
|
if (duration == 0) return;
|
||||||
Timer.periodic(Duration(seconds: duration), (_) async {
|
stopAutoRefresh();
|
||||||
|
_timer = Timer.periodic(Duration(seconds: duration), (_) async {
|
||||||
await refreshData();
|
await refreshData();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void addServer(ServerPrivateInfo info) {
|
void stopAutoRefresh() {
|
||||||
_servers.add(genInfo(info));
|
if (_timer != null) {
|
||||||
locator<ServerStore>().put(info);
|
_timer!.cancel();
|
||||||
|
_timer = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void setDisconnected() {
|
||||||
|
for (var i = 0; i < _servers.length; i++) {
|
||||||
|
_servers[i].connectionState = ServerConnectionState.disconnected;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void addServer(ServerPrivateInfo spi) {
|
||||||
|
_servers.add(genInfo(spi));
|
||||||
|
locator<ServerStore>().put(spi);
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
refreshData(idx: _servers.length - 1);
|
refreshData(spi: spi);
|
||||||
}
|
}
|
||||||
|
|
||||||
void delServer(ServerPrivateInfo info) {
|
void delServer(ServerPrivateInfo info) {
|
||||||
_servers.removeWhere((e) => e.info == info);
|
final idx = _servers.indexWhere((s) => s.info == info);
|
||||||
|
_servers[idx].client?.close();
|
||||||
|
_servers.removeAt(idx);
|
||||||
|
notifyListeners();
|
||||||
locator<ServerStore>().delete(info);
|
locator<ServerStore>().delete(info);
|
||||||
notifyListeners();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateServer(ServerPrivateInfo old, ServerPrivateInfo newInfo) {
|
Future<void> updateServer(
|
||||||
|
ServerPrivateInfo old, ServerPrivateInfo newSpi) async {
|
||||||
final idx = _servers.indexWhere((e) => e.info == old);
|
final idx = _servers.indexWhere((e) => e.info == old);
|
||||||
_servers[idx].info = newInfo;
|
if (idx < 0) {
|
||||||
_servers[idx].client = genClient(newInfo);
|
throw RangeError.index(idx, _servers);
|
||||||
locator<ServerStore>().update(old, newInfo);
|
}
|
||||||
|
_servers[idx].info = newSpi;
|
||||||
|
_servers[idx].client = await genClient(newSpi);
|
||||||
|
locator<ServerStore>().update(old, newSpi);
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
refreshData(idx: idx);
|
refreshData(spi: newSpi);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<ServerStatus?> _getData(ServerPrivateInfo info, int idx) async {
|
Future<void> _getData(ServerPrivateInfo spi) async {
|
||||||
final client = _servers[idx].client;
|
final idx = _servers.indexWhere((element) => element.info == spi);
|
||||||
final connected = await client.isConnected();
|
|
||||||
final state = _servers[idx].connectionState;
|
final state = _servers[idx].connectionState;
|
||||||
if (!connected ||
|
if (_servers[idx].client == null ||
|
||||||
state == ServerConnectionState.failed ||
|
state == ServerConnectionState.failed ||
|
||||||
state == ServerConnectionState.disconnected) {
|
state == ServerConnectionState.disconnected) {
|
||||||
_servers[idx].connectionState = ServerConnectionState.connecting;
|
_servers[idx].connectionState = ServerConnectionState.connecting;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
final time1 = DateTime.now();
|
final time1 = DateTime.now();
|
||||||
try {
|
try {
|
||||||
await client.connect();
|
_servers[idx].client = await genClient(spi);
|
||||||
final time2 = DateTime.now();
|
final time2 = DateTime.now();
|
||||||
logger.info(
|
logger.info(
|
||||||
'Connected to [${info.name}] in [${time2.difference(time1).toString()}].');
|
'Connected to [${spi.name}] in [${time2.difference(time1).toString()}].');
|
||||||
_servers[idx].connectionState = ServerConnectionState.connected;
|
_servers[idx].connectionState = ServerConnectionState.connected;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
_servers[idx].connectionState = ServerConnectionState.failed;
|
_servers[idx].connectionState = ServerConnectionState.failed;
|
||||||
|
_servers[idx].status.failedInfo = e.toString() + ' ## ';
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
logger.warning(e);
|
logger.warning(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
final si = _servers[idx];
|
||||||
try {
|
try {
|
||||||
final cpu = await client.execute("cat /proc/stat | grep cpu") ?? '';
|
if (si.client == null) return;
|
||||||
final cpuTemp = await client.execute(
|
final raw = utf8.decode(await si.client!.run(
|
||||||
r"paste <(cat /sys/class/thermal/thermal_zone*/type) <(cat /sys/class/thermal/thermal_zone*/temp) | column -s $'\t' -t | sed 's/\(.\)..$/.\1°C/'") ??
|
r"cat /proc/net/dev && date +%s && echo 'A====A' && cat /etc/os-release | grep PRETTY_NAME && echo 'A====A' && cat /proc/stat | grep cpu && echo 'A====A' && paste <(cat /sys/class/thermal/thermal_zone*/type) <(cat /sys/class/thermal/thermal_zone*/temp) | column -s $'\t' -t | sed 's/\(.\)..$/.\1°C/' && echo 'A====A' && uptime && echo 'A====A' && cat /proc/net/snmp && echo 'A====A' && df -h && echo 'A====A' && free -m"));
|
||||||
'';
|
final lines = raw.split('A====A').map((e) => e.trim()).toList();
|
||||||
final mem = await client.execute('free -m') ?? '';
|
_getCPU(spi, lines[2], lines[3]);
|
||||||
final sysVer =
|
_getMem(spi, lines[7]);
|
||||||
await client.execute('cat /etc/os-release | grep PRETTY_NAME') ?? '';
|
_getSysVer(spi, lines[1]);
|
||||||
final upTime = await client.execute('uptime') ?? '';
|
_getUpTime(spi, lines[4]);
|
||||||
final disk = await client.execute('df -h') ?? '';
|
_getDisk(spi, lines[6]);
|
||||||
final tcp = await client.execute('cat /proc/net/snmp') ?? '';
|
_getTcp(spi, lines[5]);
|
||||||
final netSpeed =
|
_getNetSpeed(spi, lines[0]);
|
||||||
await client.execute('cat /proc/net/dev && date +%s') ?? '';
|
|
||||||
|
|
||||||
return ServerStatus(
|
|
||||||
_getCPU(cpu, _servers[idx].status.cpu2Status, cpuTemp),
|
|
||||||
_getMem(mem),
|
|
||||||
_getSysVer(sysVer),
|
|
||||||
_getUpTime(upTime),
|
|
||||||
_getDisk(disk),
|
|
||||||
_getTcp(tcp),
|
|
||||||
_getNetSpeed(netSpeed, _servers[idx].status.netSpeed));
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
_servers[idx].connectionState = ServerConnectionState.failed;
|
_servers[idx].connectionState = ServerConnectionState.failed;
|
||||||
|
servers[idx].status.failedInfo = e.toString();
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
logger.warning(e);
|
logger.warning(e);
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -180,11 +202,12 @@ class ServerProvider extends BusyProvider {
|
|||||||
/// lo: 45929941 269112 0 0 0 0 0 0 45929941 269112 0 0 0 0 0 0
|
/// lo: 45929941 269112 0 0 0 0 0 0 45929941 269112 0 0 0 0 0 0
|
||||||
/// eth0: 48481023 505772 0 0 0 0 0 0 36002262 202307 0 0 0 0 0 0
|
/// eth0: 48481023 505772 0 0 0 0 0 0 36002262 202307 0 0 0 0 0 0
|
||||||
/// 1635752901
|
/// 1635752901
|
||||||
NetSpeed _getNetSpeed(String raw, NetSpeed old) {
|
void _getNetSpeed(ServerPrivateInfo spi, String raw) {
|
||||||
|
final info = _servers.firstWhere((e) => e.info == spi);
|
||||||
final split = raw.split('\n');
|
final split = raw.split('\n');
|
||||||
final deviceCount = split.length - 3;
|
final deviceCount = split.length - 3;
|
||||||
if (deviceCount < 1) return emptyNetSpeed;
|
if (deviceCount < 1) return;
|
||||||
final time = int.parse(split[split.length - 2]);
|
final time = int.parse(split[split.length - 1]);
|
||||||
final results = <NetSpeedPart>[];
|
final results = <NetSpeedPart>[];
|
||||||
for (int idx = 2; idx < deviceCount; idx++) {
|
for (int idx = 2; idx < deviceCount; idx++) {
|
||||||
final data = split[idx].trim().split(':');
|
final data = split[idx].trim().split(':');
|
||||||
@@ -195,15 +218,18 @@ class ServerProvider extends BusyProvider {
|
|||||||
final bytesOut = int.parse(bytes[8]);
|
final bytesOut = int.parse(bytes[8]);
|
||||||
results.add(NetSpeedPart(device, bytesIn, bytesOut, time));
|
results.add(NetSpeedPart(device, bytesIn, bytesOut, time));
|
||||||
}
|
}
|
||||||
return old.update(results);
|
info.status.netSpeed = info.status.netSpeed.update(results);
|
||||||
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
String _getSysVer(String raw) {
|
void _getSysVer(ServerPrivateInfo spi, String raw) {
|
||||||
|
final info = _servers.firstWhere((e) => e.info == spi);
|
||||||
final s = raw.split('=');
|
final s = raw.split('=');
|
||||||
if (s.length == 2) {
|
if (s.length == 2) {
|
||||||
return s[1].replaceAll('"', '').replaceFirst('\n', '');
|
info.status.sysVer = s[1].replaceAll('"', '').replaceFirst('\n', '');
|
||||||
}
|
}
|
||||||
return '';
|
|
||||||
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
String _getCPUTemp(String raw) {
|
String _getCPUTemp(String raw) {
|
||||||
@@ -216,7 +242,8 @@ class ServerProvider extends BusyProvider {
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
Cpu2Status _getCPU(String raw, Cpu2Status old, String temp) {
|
void _getCPU(ServerPrivateInfo spi, String raw, String temp) {
|
||||||
|
final info = _servers.firstWhere((e) => e.info == spi);
|
||||||
final List<CpuStatus> cpus = [];
|
final List<CpuStatus> cpus = [];
|
||||||
|
|
||||||
for (var item in raw.split('\n')) {
|
for (var item in raw.split('\n')) {
|
||||||
@@ -233,35 +260,36 @@ class ServerProvider extends BusyProvider {
|
|||||||
int.parse(matches[5]),
|
int.parse(matches[5]),
|
||||||
int.parse(matches[6])));
|
int.parse(matches[6])));
|
||||||
}
|
}
|
||||||
if (cpus.isEmpty) {
|
if (cpus.isNotEmpty) {
|
||||||
return emptyCpu2Status;
|
info.status.cpu2Status =
|
||||||
|
info.status.cpu2Status.update(cpus, _getCPUTemp(temp));
|
||||||
}
|
}
|
||||||
|
|
||||||
return old.update(cpus, _getCPUTemp(temp));
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
String _getUpTime(String raw) {
|
void _getUpTime(ServerPrivateInfo spi, String raw) {
|
||||||
return raw.split('up ')[1].split(', ')[0];
|
_servers.firstWhere((e) => e.info == spi).status.uptime =
|
||||||
|
raw.split('up ')[1].split(', ')[0];
|
||||||
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
TcpStatus _getTcp(String raw) {
|
void _getTcp(ServerPrivateInfo spi, String raw) {
|
||||||
|
final info = _servers.firstWhere((e) => e.info == spi);
|
||||||
final lines = raw.split('\n');
|
final lines = raw.split('\n');
|
||||||
int idx = 0;
|
final idx = lines.lastWhere((element) => element.startsWith('Tcp:'),
|
||||||
for (var item in lines) {
|
orElse: () => '');
|
||||||
if (item.contains('Tcp:')) {
|
if (idx != '') {
|
||||||
idx++;
|
final vals = idx.split(RegExp(r'\s{1,}'));
|
||||||
}
|
info.status.tcp = TcpStatus(vals[5].i, vals[6].i, vals[7].i, vals[8].i);
|
||||||
if (idx == 2) {
|
|
||||||
final vals = item.split(RegExp(r'\s{1,}'));
|
|
||||||
return TcpStatus(vals[5].i, vals[6].i, vals[7].i, vals[8].i);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return TcpStatus(0, 0, 0, 0);
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
List<DiskInfo> _getDisk(String disk) {
|
void _getDisk(ServerPrivateInfo spi, String raw) {
|
||||||
|
final info = _servers.firstWhere((e) => e.info == spi);
|
||||||
final list = <DiskInfo>[];
|
final list = <DiskInfo>[];
|
||||||
final items = disk.split('\n');
|
final items = raw.split('\n');
|
||||||
for (var item in items) {
|
for (var item in items) {
|
||||||
if (items.indexOf(item) == 0 || item.isEmpty) {
|
if (items.indexOf(item) == 0 || item.isEmpty) {
|
||||||
continue;
|
continue;
|
||||||
@@ -270,16 +298,18 @@ class ServerProvider extends BusyProvider {
|
|||||||
list.add(DiskInfo(vals[0], vals[5],
|
list.add(DiskInfo(vals[0], vals[5],
|
||||||
int.parse(vals[4].replaceFirst('%', '')), vals[2], vals[1], vals[3]));
|
int.parse(vals[4].replaceFirst('%', '')), vals[2], vals[1], vals[3]));
|
||||||
}
|
}
|
||||||
return list;
|
info.status.disk = list;
|
||||||
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
Memory _getMem(String mem) {
|
void _getMem(ServerPrivateInfo spi, String raw) {
|
||||||
for (var item in mem.split('\n')) {
|
final info = _servers.firstWhere((e) => e.info == spi);
|
||||||
|
for (var item in raw.split('\n')) {
|
||||||
if (item.contains('Mem:')) {
|
if (item.contains('Mem:')) {
|
||||||
final split = item.replaceFirst('Mem:', '').split(' ');
|
final split = item.replaceFirst('Mem:', '').split(' ');
|
||||||
split.removeWhere((e) => e == '');
|
split.removeWhere((e) => e == '');
|
||||||
final memList = split.map((e) => int.parse(e)).toList();
|
final memList = split.map((e) => int.parse(e)).toList();
|
||||||
return Memory(
|
info.status.memory = Memory(
|
||||||
total: memList[0],
|
total: memList[0],
|
||||||
used: memList[1],
|
used: memList[1],
|
||||||
free: memList[2],
|
free: memList[2],
|
||||||
@@ -288,6 +318,14 @@ class ServerProvider extends BusyProvider {
|
|||||||
avail: memList[5]);
|
avail: memList[5]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return emptyMemory;
|
notifyListeners();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<String?> runSnippet(ServerPrivateInfo spi, Snippet snippet) async {
|
||||||
|
final result = await _servers
|
||||||
|
.firstWhere((element) => element.info == spi)
|
||||||
|
.client!
|
||||||
|
.run(snippet.script);
|
||||||
|
return utf8.decode(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
32
lib/data/provider/snippet.dart
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
import 'package:toolbox/core/provider_base.dart';
|
||||||
|
import 'package:toolbox/data/model/server/snippet.dart';
|
||||||
|
import 'package:toolbox/data/store/snippet.dart';
|
||||||
|
import 'package:toolbox/locator.dart';
|
||||||
|
|
||||||
|
class SnippetProvider extends BusyProvider {
|
||||||
|
List<Snippet> get snippets => _snippets;
|
||||||
|
late List<Snippet> _snippets;
|
||||||
|
|
||||||
|
void loadData() {
|
||||||
|
_snippets = locator<SnippetStore>().fetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
void addInfo(Snippet snippet) {
|
||||||
|
_snippets.add(snippet);
|
||||||
|
locator<SnippetStore>().put(snippet);
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
|
||||||
|
void delInfo(Snippet snippet) {
|
||||||
|
_snippets.removeWhere((e) => e.name == snippet.name);
|
||||||
|
locator<SnippetStore>().delete(snippet);
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
|
||||||
|
void updateInfo(Snippet old, Snippet newOne) {
|
||||||
|
final idx = _snippets.indexWhere((e) => e.name == old.name);
|
||||||
|
_snippets[idx] = newOne;
|
||||||
|
locator<SnippetStore>().update(old, newOne);
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
// This file is generated by ./make.dart
|
// This file is generated by ./make.dart
|
||||||
|
|
||||||
class BuildData {
|
class BuildData {
|
||||||
static const String name = "ToolBox";
|
static const String name = "ServerBox";
|
||||||
static const int build = 55;
|
static const int build = 95;
|
||||||
static const String engine =
|
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";
|
"Flutter 2.10.0 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision 5f105a6ca7 (7 days ago) • 2022-02-01 14:15:42 -0800\nEngine • revision 776efd2034\nTools • Dart 2.16.0 • DevTools 2.9.2\n";
|
||||||
static const String buildAt = "2021-11-02 15:32:29.280614";
|
static const String buildAt = "2022-02-08 21:30:51.218738";
|
||||||
static const int modifications = 1;
|
static const int modifications = 3;
|
||||||
}
|
}
|
||||||
|
|||||||
3
lib/data/res/padding.dart
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
const roundRectCardPadding = EdgeInsets.symmetric(horizontal: 17);
|
||||||
9
lib/data/res/tab.dart
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:toolbox/data/model/app/navigation_item.dart';
|
||||||
|
|
||||||
|
final List<String> tabs = ['Servers', 'En/Decode', 'Ping'];
|
||||||
|
final List<NavigationItem> tabItems = [
|
||||||
|
NavigationItem(Icons.computer, 'Server'),
|
||||||
|
NavigationItem(Icons.code, 'Convert'),
|
||||||
|
NavigationItem(Icons.network_check, 'Ping'),
|
||||||
|
];
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
const backendUrl = 'https://v2.custed.lolli.tech';
|
const backendUrl = 'https://res.lolli.tech';
|
||||||
const baseUrl = backendUrl + '/res/toolbox';
|
const baseUrl = backendUrl + '/toolbox';
|
||||||
const joinQQGroupUrl = 'https://jq.qq.com/?_wv=1027&k=G0hUmPAq';
|
const joinQQGroupUrl = 'https://jq.qq.com/?_wv=1027&k=G0hUmPAq';
|
||||||
const myGithub = 'https://github.com/LollipopKit';
|
const myGithub = 'https://github.com/LollipopKit';
|
||||||
const rainSunMeGithub = 'https://github.com/RainSunMe';
|
const rainSunMeGithub = 'https://github.com/RainSunMe';
|
||||||
|
|||||||
@@ -15,6 +15,11 @@ class PrivateKeyStore extends PersistentStore {
|
|||||||
json.decode(box.get('key', defaultValue: '[]')!));
|
json.decode(box.get('key', defaultValue: '[]')!));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PrivateKeyInfo get(String id) {
|
||||||
|
final ss = fetch();
|
||||||
|
return ss.firstWhere((e) => e.id == id);
|
||||||
|
}
|
||||||
|
|
||||||
void delete(PrivateKeyInfo s) {
|
void delete(PrivateKeyInfo s) {
|
||||||
final ss = fetch();
|
final ss = fetch();
|
||||||
ss.removeAt(index(s));
|
ss.removeAt(index(s));
|
||||||
|
|||||||
@@ -23,7 +23,11 @@ class ServerStore extends PersistentStore {
|
|||||||
|
|
||||||
void update(ServerPrivateInfo old, ServerPrivateInfo newInfo) {
|
void update(ServerPrivateInfo old, ServerPrivateInfo newInfo) {
|
||||||
final ss = fetch();
|
final ss = fetch();
|
||||||
ss[index(old)] = newInfo;
|
final idx = index(old);
|
||||||
|
if (idx < 0) {
|
||||||
|
throw RangeError.index(idx, ss);
|
||||||
|
}
|
||||||
|
ss[idx] = newInfo;
|
||||||
box.put('servers', json.encode(ss));
|
box.put('servers', json.encode(ss));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,5 +5,6 @@ class SettingStore extends PersistentStore {
|
|||||||
StoreProperty<int> get primaryColor =>
|
StoreProperty<int> get primaryColor =>
|
||||||
property('primaryColor', defaultValue: Colors.deepPurpleAccent.value);
|
property('primaryColor', defaultValue: Colors.deepPurpleAccent.value);
|
||||||
StoreProperty<int> get serverStatusUpdateInterval =>
|
StoreProperty<int> get serverStatusUpdateInterval =>
|
||||||
property('serverStatusUpdateInterval', defaultValue: 3);
|
property('serverStatusUpdateInterval', defaultValue: 2);
|
||||||
|
StoreProperty<int> get launchPage => property('launchPage', defaultValue: 0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import 'package:toolbox/data/provider/app.dart';
|
|||||||
import 'package:toolbox/data/provider/debug.dart';
|
import 'package:toolbox/data/provider/debug.dart';
|
||||||
import 'package:toolbox/data/provider/private_key.dart';
|
import 'package:toolbox/data/provider/private_key.dart';
|
||||||
import 'package:toolbox/data/provider/server.dart';
|
import 'package:toolbox/data/provider/server.dart';
|
||||||
|
import 'package:toolbox/data/provider/snippet.dart';
|
||||||
import 'package:toolbox/data/service/app.dart';
|
import 'package:toolbox/data/service/app.dart';
|
||||||
import 'package:toolbox/data/store/private_key.dart';
|
import 'package:toolbox/data/store/private_key.dart';
|
||||||
import 'package:toolbox/data/store/server.dart';
|
import 'package:toolbox/data/store/server.dart';
|
||||||
@@ -19,6 +20,7 @@ void setupLocatorForProviders() {
|
|||||||
locator.registerSingleton(AppProvider());
|
locator.registerSingleton(AppProvider());
|
||||||
locator.registerSingleton(DebugProvider());
|
locator.registerSingleton(DebugProvider());
|
||||||
locator.registerSingleton(ServerProvider());
|
locator.registerSingleton(ServerProvider());
|
||||||
|
locator.registerSingleton(SnippetProvider());
|
||||||
locator.registerSingleton(PrivateKeyProvider());
|
locator.registerSingleton(PrivateKeyProvider());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,11 +10,13 @@ import 'package:toolbox/data/provider/app.dart';
|
|||||||
import 'package:toolbox/data/provider/debug.dart';
|
import 'package:toolbox/data/provider/debug.dart';
|
||||||
import 'package:toolbox/data/provider/private_key.dart';
|
import 'package:toolbox/data/provider/private_key.dart';
|
||||||
import 'package:toolbox/data/provider/server.dart';
|
import 'package:toolbox/data/provider/server.dart';
|
||||||
|
import 'package:toolbox/data/provider/snippet.dart';
|
||||||
import 'package:toolbox/locator.dart';
|
import 'package:toolbox/locator.dart';
|
||||||
|
|
||||||
Future<void> initApp() async {
|
Future<void> initApp() async {
|
||||||
await Hive.initFlutter();
|
await Hive.initFlutter();
|
||||||
await setupLocator();
|
await setupLocator();
|
||||||
|
locator<SnippetProvider>().loadData();
|
||||||
locator<PrivateKeyProvider>().loadData();
|
locator<PrivateKeyProvider>().loadData();
|
||||||
|
|
||||||
///设置Logger
|
///设置Logger
|
||||||
@@ -62,6 +64,7 @@ Future<void> main() async {
|
|||||||
ChangeNotifierProvider(create: (_) => locator<AppProvider>()),
|
ChangeNotifierProvider(create: (_) => locator<AppProvider>()),
|
||||||
ChangeNotifierProvider(create: (_) => locator<DebugProvider>()),
|
ChangeNotifierProvider(create: (_) => locator<DebugProvider>()),
|
||||||
ChangeNotifierProvider(create: (_) => locator<ServerProvider>()),
|
ChangeNotifierProvider(create: (_) => locator<ServerProvider>()),
|
||||||
|
ChangeNotifierProvider(create: (_) => locator<SnippetProvider>()),
|
||||||
ChangeNotifierProvider(create: (_) => locator<PrivateKeyProvider>()),
|
ChangeNotifierProvider(create: (_) => locator<PrivateKeyProvider>()),
|
||||||
],
|
],
|
||||||
child: const MyApp(),
|
child: const MyApp(),
|
||||||
|
|||||||
@@ -2,8 +2,10 @@ import 'dart:convert';
|
|||||||
|
|
||||||
import 'package:clipboard/clipboard.dart';
|
import 'package:clipboard/clipboard.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_staggered_animations/flutter_staggered_animations.dart';
|
import 'package:toolbox/core/utils.dart';
|
||||||
import 'package:toolbox/data/res/color.dart';
|
import 'package:toolbox/data/res/color.dart';
|
||||||
|
import 'package:toolbox/view/widget/input_field.dart';
|
||||||
|
import 'package:toolbox/view/widget/round_rect_card.dart';
|
||||||
|
|
||||||
class ConvertPage extends StatefulWidget {
|
class ConvertPage extends StatefulWidget {
|
||||||
const ConvertPage({Key? key}) : super(key: key);
|
const ConvertPage({Key? key}) : super(key: key);
|
||||||
@@ -47,30 +49,22 @@ class _ConvertPageState extends State<ConvertPage>
|
|||||||
return Scaffold(
|
return Scaffold(
|
||||||
body: GestureDetector(
|
body: GestureDetector(
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 7),
|
padding: const EdgeInsets.symmetric(horizontal: 7),
|
||||||
child: AnimationLimiter(
|
child: Column(children: [
|
||||||
child: Column(
|
|
||||||
children: AnimationConfiguration.toStaggeredList(
|
|
||||||
duration: const Duration(milliseconds: 377),
|
|
||||||
childAnimationBuilder: (widget) => SlideAnimation(
|
|
||||||
verticalOffset: 50.0,
|
|
||||||
child: FadeInAnimation(
|
|
||||||
child: widget,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
children: [
|
|
||||||
const SizedBox(height: 13),
|
const SizedBox(height: 13),
|
||||||
_buildInputTop(),
|
_buildInputTop(),
|
||||||
_buildTypeOption(),
|
_buildTypeOption(),
|
||||||
_buildResult(),
|
_buildResult(),
|
||||||
],
|
])),
|
||||||
))),
|
|
||||||
),
|
|
||||||
onTap: () => FocusScope.of(context).requestFocus(FocusNode()),
|
onTap: () => FocusScope.of(context).requestFocus(FocusNode()),
|
||||||
),
|
),
|
||||||
floatingActionButton: FloatingActionButton(
|
floatingActionButton: FloatingActionButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
_textEditingControllerResult.text = doConvert();
|
try {
|
||||||
|
_textEditingControllerResult.text = doConvert();
|
||||||
|
} catch (e) {
|
||||||
|
showSnackBar(context, Text('Error: \n$e'));
|
||||||
|
}
|
||||||
},
|
},
|
||||||
tooltip: 'convert',
|
tooltip: 'convert',
|
||||||
child: const Icon(Icons.send),
|
child: const Icon(Icons.send),
|
||||||
@@ -79,7 +73,7 @@ class _ConvertPageState extends State<ConvertPage>
|
|||||||
}
|
}
|
||||||
|
|
||||||
String doConvert() {
|
String doConvert() {
|
||||||
final text = _textEditingController.text;
|
final text = _textEditingController.text.trim();
|
||||||
switch (_typeOptionIndex) {
|
switch (_typeOptionIndex) {
|
||||||
case 0:
|
case 0:
|
||||||
return utf8.decode(base64.decode(text));
|
return utf8.decode(base64.decode(text));
|
||||||
@@ -90,20 +84,20 @@ class _ConvertPageState extends State<ConvertPage>
|
|||||||
case 3:
|
case 3:
|
||||||
return Uri.decodeFull(text);
|
return Uri.decodeFull(text);
|
||||||
default:
|
default:
|
||||||
return 'Unknown';
|
return 'Unknown Convert Method';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildInputTop() {
|
Widget _buildInputTop() {
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
height: _media.size.height * 0.33,
|
height: _media.size.height * 0.33,
|
||||||
child: _buildInput(_textEditingController),
|
child: buildInput(context, _textEditingController),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildTypeOption() {
|
Widget _buildTypeOption() {
|
||||||
return Card(
|
return RoundRectCard(
|
||||||
child: ExpansionTile(
|
ExpansionTile(
|
||||||
tilePadding: const EdgeInsets.only(left: 7, right: 27),
|
tilePadding: const EdgeInsets.only(left: 7, right: 27),
|
||||||
childrenPadding: EdgeInsets.zero,
|
childrenPadding: EdgeInsets.zero,
|
||||||
title: Row(
|
title: Row(
|
||||||
@@ -169,20 +163,7 @@ class _ConvertPageState extends State<ConvertPage>
|
|||||||
Widget _buildResult() {
|
Widget _buildResult() {
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
height: _media.size.height * 0.33,
|
height: _media.size.height * 0.33,
|
||||||
child: _buildInput(_textEditingControllerResult),
|
child: buildInput(context, _textEditingControllerResult),
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _buildInput(TextEditingController controller) {
|
|
||||||
return Card(
|
|
||||||
child: TextField(
|
|
||||||
maxLines: 20,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
fillColor: Theme.of(context).cardColor,
|
|
||||||
filled: true,
|
|
||||||
border: InputBorder.none),
|
|
||||||
controller: controller,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ class _DebugPageState extends State<DebugPage> {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar:
|
appBar:
|
||||||
AppBar(title: const Text('Terminal'), backgroundColor: Colors.black),
|
AppBar(title: const Text('App log'), backgroundColor: Colors.black),
|
||||||
body: _buildTerminal(context),
|
body: _buildTerminal(context),
|
||||||
backgroundColor: Colors.black,
|
backgroundColor: Colors.black,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,19 +1,25 @@
|
|||||||
import 'package:after_layout/after_layout.dart';
|
import 'package:after_layout/after_layout.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_advanced_drawer/flutter_advanced_drawer.dart';
|
||||||
import 'package:get_it/get_it.dart';
|
import 'package:get_it/get_it.dart';
|
||||||
import 'package:toolbox/core/analysis.dart';
|
import 'package:toolbox/core/analysis.dart';
|
||||||
import 'package:toolbox/core/build_mode.dart';
|
import 'package:toolbox/core/build_mode.dart';
|
||||||
import 'package:toolbox/core/route.dart';
|
import 'package:toolbox/core/route.dart';
|
||||||
import 'package:toolbox/core/update.dart';
|
import 'package:toolbox/core/update.dart';
|
||||||
import 'package:toolbox/core/utils.dart';
|
import 'package:toolbox/core/utils.dart';
|
||||||
|
import 'package:toolbox/data/model/app/navigation_item.dart';
|
||||||
import 'package:toolbox/data/provider/server.dart';
|
import 'package:toolbox/data/provider/server.dart';
|
||||||
import 'package:toolbox/data/res/build_data.dart';
|
import 'package:toolbox/data/res/build_data.dart';
|
||||||
|
import 'package:toolbox/data/res/color.dart';
|
||||||
import 'package:toolbox/data/res/icon/common.dart';
|
import 'package:toolbox/data/res/icon/common.dart';
|
||||||
|
import 'package:toolbox/data/res/tab.dart';
|
||||||
import 'package:toolbox/data/res/url.dart';
|
import 'package:toolbox/data/res/url.dart';
|
||||||
|
import 'package:toolbox/data/store/setting.dart';
|
||||||
import 'package:toolbox/locator.dart';
|
import 'package:toolbox/locator.dart';
|
||||||
import 'package:toolbox/view/page/convert.dart';
|
import 'package:toolbox/view/page/convert.dart';
|
||||||
import 'package:toolbox/view/page/debug.dart';
|
import 'package:toolbox/view/page/debug.dart';
|
||||||
import 'package:toolbox/view/page/private_key/stored.dart';
|
import 'package:toolbox/view/page/ping.dart';
|
||||||
|
import 'package:toolbox/view/page/private_key/list.dart';
|
||||||
import 'package:toolbox/view/page/server/tab.dart';
|
import 'package:toolbox/view/page/server/tab.dart';
|
||||||
import 'package:toolbox/view/page/setting.dart';
|
import 'package:toolbox/view/page/setting.dart';
|
||||||
import 'package:toolbox/view/page/snippet/list.dart';
|
import 'package:toolbox/view/page/snippet/list.dart';
|
||||||
@@ -31,50 +37,181 @@ class _MyHomePageState extends State<MyHomePage>
|
|||||||
with
|
with
|
||||||
AutomaticKeepAliveClientMixin,
|
AutomaticKeepAliveClientMixin,
|
||||||
SingleTickerProviderStateMixin,
|
SingleTickerProviderStateMixin,
|
||||||
AfterLayoutMixin {
|
AfterLayoutMixin,
|
||||||
final List<String> _tabs = ['Servers', 'En/Decode'];
|
WidgetsBindingObserver {
|
||||||
late final TabController _tabController;
|
late final ServerProvider _serverProvider;
|
||||||
|
late final PageController _pageController;
|
||||||
|
late final AdvancedDrawerController _advancedDrawerController;
|
||||||
|
late int _selectIndex;
|
||||||
|
late double _width;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_tabController = TabController(length: _tabs.length, vsync: this);
|
_serverProvider = locator<ServerProvider>();
|
||||||
|
WidgetsBinding.instance?.addObserver(this);
|
||||||
|
_selectIndex = locator<SettingStore>().launchPage.fetch()!;
|
||||||
|
_pageController = PageController(initialPage: _selectIndex);
|
||||||
|
_advancedDrawerController = AdvancedDrawerController();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void didChangeDependencies() {
|
||||||
|
super.didChangeDependencies();
|
||||||
|
_width = MediaQuery.of(context).size.width;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
super.dispose();
|
||||||
|
WidgetsBinding.instance?.removeObserver(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void didChangeAppLifecycleState(AppLifecycleState state) {
|
||||||
|
super.didChangeAppLifecycleState(state);
|
||||||
|
if (state == AppLifecycleState.paused) {
|
||||||
|
_serverProvider.setDisconnected();
|
||||||
|
_serverProvider.stopAutoRefresh();
|
||||||
|
}
|
||||||
|
if (state == AppLifecycleState.resumed) {
|
||||||
|
_serverProvider.startAutoRefresh();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
setTransparentNavigationBar(context);
|
setTransparentNavigationBar(context);
|
||||||
super.build(context);
|
super.build(context);
|
||||||
return Scaffold(
|
return WillPopScope(
|
||||||
appBar: AppBar(
|
child: _buildMain(context),
|
||||||
title: GestureDetector(
|
onWillPop: () {
|
||||||
onLongPress: () =>
|
if (_advancedDrawerController.value.visible) {
|
||||||
AppRoute(const DebugPage(), 'Debug Page').go(context),
|
_advancedDrawerController.hideDrawer();
|
||||||
child: const Text('ToolBox'),
|
return Future.value(false);
|
||||||
),
|
}
|
||||||
bottom: TabBar(
|
return Future.value(true);
|
||||||
indicatorColor: widget.primaryColor,
|
});
|
||||||
tabs: _tabs.map((e) => Tab(text: e)).toList(),
|
}
|
||||||
controller: _tabController,
|
|
||||||
|
Widget _buildMain(BuildContext context) {
|
||||||
|
return AdvancedDrawer(
|
||||||
|
controller: _advancedDrawerController,
|
||||||
|
animationCurve: Curves.easeInOutCirc,
|
||||||
|
animationDuration: const Duration(milliseconds: 300),
|
||||||
|
animateChildDecoration: true,
|
||||||
|
rtlOpening: false,
|
||||||
|
disabledGestures: true,
|
||||||
|
childDecoration: const BoxDecoration(
|
||||||
|
// NOTICE: Uncomment if you want to add shadow behind the page.
|
||||||
|
// Keep in mind that it may cause animation jerks.
|
||||||
|
boxShadow: <BoxShadow>[
|
||||||
|
BoxShadow(
|
||||||
|
color: Colors.black12,
|
||||||
|
blurRadius: 0.0,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
borderRadius: BorderRadius.all(Radius.circular(16)),
|
||||||
),
|
),
|
||||||
|
drawer: _buildDrawer(),
|
||||||
|
child: Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
title: Text(tabItems[_selectIndex].title),
|
||||||
|
actions: [
|
||||||
|
IconButton(
|
||||||
|
icon: const Icon(Icons.developer_mode, size: 23),
|
||||||
|
tooltip: 'Debug',
|
||||||
|
onPressed: () =>
|
||||||
|
AppRoute(const DebugPage(), 'Debug Page').go(context),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
leading: IconButton(
|
||||||
|
onPressed: () => _advancedDrawerController.showDrawer(),
|
||||||
|
icon: ValueListenableBuilder<AdvancedDrawerValue>(
|
||||||
|
valueListenable: _advancedDrawerController,
|
||||||
|
builder: (_, value, __) {
|
||||||
|
return AnimatedSwitcher(
|
||||||
|
duration: const Duration(milliseconds: 250),
|
||||||
|
child: Icon(
|
||||||
|
value.visible ? Icons.clear : Icons.menu,
|
||||||
|
key: ValueKey<bool>(value.visible),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: PageView(
|
||||||
|
physics: const ClampingScrollPhysics(),
|
||||||
|
controller: _pageController,
|
||||||
|
onPageChanged: (i) {
|
||||||
|
FocusScope.of(context).unfocus();
|
||||||
|
_selectIndex = i;
|
||||||
|
setState(() {});
|
||||||
|
},
|
||||||
|
children: const [ServerPage(), ConvertPage(), PingPage()],
|
||||||
|
),
|
||||||
|
bottomNavigationBar: _buildBottom(context),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildItem(int idx, NavigationItem item, bool isSelected) {
|
||||||
|
bool isDarkMode = Theme.of(context).brightness == Brightness.dark;
|
||||||
|
final width = _width / tabItems.length;
|
||||||
|
return AnimatedContainer(
|
||||||
|
duration: const Duration(milliseconds: 377),
|
||||||
|
curve: Curves.fastOutSlowIn,
|
||||||
|
height: 50,
|
||||||
|
width: isSelected ? width : width - 17,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: isSelected
|
||||||
|
? isDarkMode
|
||||||
|
? Colors.white12
|
||||||
|
: Colors.black.withOpacity(0.07)
|
||||||
|
: Colors.transparent,
|
||||||
|
borderRadius: const BorderRadius.all(Radius.circular(50))),
|
||||||
|
child: IconButton(
|
||||||
|
icon: Icon(item.icon),
|
||||||
|
tooltip: item.title,
|
||||||
|
splashRadius: width / 3.3,
|
||||||
|
padding: const EdgeInsets.only(left: 17, right: 17),
|
||||||
|
onPressed: () {
|
||||||
|
setState(() {
|
||||||
|
_pageController.animateToPage(idx,
|
||||||
|
duration: const Duration(milliseconds: 677),
|
||||||
|
curve: Curves.fastLinearToSlowEaseIn);
|
||||||
|
});
|
||||||
|
},
|
||||||
),
|
),
|
||||||
drawer: _buildDrawer(),
|
|
||||||
body: TabBarView(controller: _tabController, children: const [
|
|
||||||
ServerPage(),
|
|
||||||
ConvertPage(),
|
|
||||||
]),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget _buildBottom(BuildContext context) {
|
||||||
|
return SafeArea(
|
||||||
|
child: Container(
|
||||||
|
height: 56,
|
||||||
|
padding: const EdgeInsets.only(left: 8, top: 4, bottom: 4, right: 8),
|
||||||
|
width: _width,
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
|
children: tabItems.map((item) {
|
||||||
|
int itemIndex = tabItems.indexOf(item);
|
||||||
|
return _buildItem(itemIndex, item, _selectIndex == itemIndex);
|
||||||
|
}).toList(),
|
||||||
|
),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
Widget _buildDrawer() {
|
Widget _buildDrawer() {
|
||||||
return Drawer(
|
return SafeArea(
|
||||||
child: ListView(
|
child: Column(
|
||||||
padding: EdgeInsets.zero,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
UserAccountsDrawerHeader(
|
_buildIcon(),
|
||||||
accountName: const Text(BuildData.name),
|
const Text(BuildData.name),
|
||||||
accountEmail: Text(_buildVersionStr()),
|
Text(_buildVersionStr()),
|
||||||
currentAccountPicture: _buildIcon(),
|
SizedBox(
|
||||||
|
height: MediaQuery.of(context).size.height * 0.07,
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: const Icon(Icons.settings),
|
leading: const Icon(Icons.settings),
|
||||||
@@ -92,8 +229,7 @@ class _MyHomePageState extends State<MyHomePage>
|
|||||||
leading: const Icon(Icons.snippet_folder),
|
leading: const Icon(Icons.snippet_folder),
|
||||||
title: const Text('Snippet'),
|
title: const Text('Snippet'),
|
||||||
onTap: () =>
|
onTap: () =>
|
||||||
AppRoute(const SnippetListPage(), 'snippet list')
|
AppRoute(const SnippetListPage(), 'snippet list').go(context),
|
||||||
.go(context),
|
|
||||||
),
|
),
|
||||||
AboutListTile(
|
AboutListTile(
|
||||||
icon: const Icon(Icons.text_snippet),
|
icon: const Icon(Icons.text_snippet),
|
||||||
@@ -117,9 +253,19 @@ class _MyHomePageState extends State<MyHomePage>
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildIcon() {
|
Widget _buildIcon() {
|
||||||
return ConstrainedBox(
|
return Stack(
|
||||||
constraints: const BoxConstraints(maxHeight: 60, maxWidth: 60),
|
alignment: Alignment.center,
|
||||||
child: appIcon,
|
children: [
|
||||||
|
ConstrainedBox(
|
||||||
|
constraints: const BoxConstraints(maxHeight: 53, maxWidth: 53),
|
||||||
|
child: Container(
|
||||||
|
color: primaryColor,
|
||||||
|
)),
|
||||||
|
ConstrainedBox(
|
||||||
|
constraints: const BoxConstraints(maxHeight: 83, maxWidth: 83),
|
||||||
|
child: appIcon,
|
||||||
|
)
|
||||||
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
123
lib/view/page/ping.dart
Normal file
@@ -0,0 +1,123 @@
|
|||||||
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:dart_ping/dart_ping.dart';
|
||||||
|
import 'package:dart_ping_ios/dart_ping_ios.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:toolbox/core/utils.dart';
|
||||||
|
import 'package:toolbox/data/res/color.dart';
|
||||||
|
import 'package:toolbox/view/widget/input_field.dart';
|
||||||
|
import 'package:toolbox/view/widget/round_rect_card.dart';
|
||||||
|
|
||||||
|
class PingPage extends StatefulWidget {
|
||||||
|
const PingPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_PingPageState createState() => _PingPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _PingPageState extends State<PingPage>
|
||||||
|
with AutomaticKeepAliveClientMixin {
|
||||||
|
late TextEditingController _textEditingController;
|
||||||
|
late TextEditingController _textEditingControllerResult;
|
||||||
|
late String _result;
|
||||||
|
Ping? _ping;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
_textEditingController = TextEditingController(text: '');
|
||||||
|
_textEditingControllerResult = TextEditingController(text: '');
|
||||||
|
if (Platform.isIOS) {
|
||||||
|
DartPingIOS.register();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void didChangeDependencies() {
|
||||||
|
super.didChangeDependencies();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
super.build(context);
|
||||||
|
return Scaffold(
|
||||||
|
body: GestureDetector(
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 7),
|
||||||
|
child: Column(children: [
|
||||||
|
const SizedBox(height: 13),
|
||||||
|
buildInput(context, _textEditingController, maxLines: 1),
|
||||||
|
_buildControl(),
|
||||||
|
buildInput(context, _textEditingControllerResult),
|
||||||
|
])),
|
||||||
|
onTap: () => FocusScope.of(context).requestFocus(FocusNode()),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void doPing() {
|
||||||
|
_result = '';
|
||||||
|
_ping = Ping(_textEditingController.text.trim());
|
||||||
|
_ping!.stream.listen((event) {
|
||||||
|
final resp = event.response.toString();
|
||||||
|
if (resp == 'null') return;
|
||||||
|
_result += '$resp\n';
|
||||||
|
_textEditingControllerResult.text = _result;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildControl() {
|
||||||
|
return SizedBox(
|
||||||
|
height: 57,
|
||||||
|
child: RoundRectCard(
|
||||||
|
InkWell(
|
||||||
|
onTap: () => FocusScope.of(context).unfocus(),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
|
children: [
|
||||||
|
TextButton(
|
||||||
|
style: ButtonStyle(
|
||||||
|
foregroundColor: MaterialStateProperty.all(primaryColor)),
|
||||||
|
child: Row(
|
||||||
|
children: const [
|
||||||
|
Icon(Icons.stop),
|
||||||
|
SizedBox(
|
||||||
|
width: 7,
|
||||||
|
),
|
||||||
|
Text('Stop')
|
||||||
|
],
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
if (_ping != null) _ping!.stop();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
TextButton(
|
||||||
|
style: ButtonStyle(
|
||||||
|
foregroundColor: MaterialStateProperty.all(primaryColor)),
|
||||||
|
child: Row(
|
||||||
|
children: const [
|
||||||
|
Icon(Icons.play_arrow),
|
||||||
|
SizedBox(
|
||||||
|
width: 7,
|
||||||
|
),
|
||||||
|
Text('Start')
|
||||||
|
],
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
try {
|
||||||
|
doPing();
|
||||||
|
} catch (e) {
|
||||||
|
showSnackBar(context, Text('Error: \n$e'));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool get wantKeepAlive => true;
|
||||||
|
}
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
import 'package:after_layout/after_layout.dart';
|
import 'package:after_layout/after_layout.dart';
|
||||||
|
import 'package:dartssh2/dartssh2.dart';
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:toolbox/core/utils.dart';
|
||||||
import 'package:toolbox/data/model/server/private_key_info.dart';
|
import 'package:toolbox/data/model/server/private_key_info.dart';
|
||||||
import 'package:toolbox/data/provider/private_key.dart';
|
import 'package:toolbox/data/provider/private_key.dart';
|
||||||
import 'package:toolbox/locator.dart';
|
import 'package:toolbox/locator.dart';
|
||||||
@@ -21,11 +24,13 @@ class _PrivateKeyEditPageState extends State<PrivateKeyEditPage>
|
|||||||
final pwdController = TextEditingController();
|
final pwdController = TextEditingController();
|
||||||
|
|
||||||
late PrivateKeyProvider _provider;
|
late PrivateKeyProvider _provider;
|
||||||
|
late Widget loading;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_provider = locator<PrivateKeyProvider>();
|
_provider = locator<PrivateKeyProvider>();
|
||||||
|
loading = const SizedBox();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -65,13 +70,43 @@ class _PrivateKeyEditPageState extends State<PrivateKeyEditPage>
|
|||||||
obscureText: true,
|
obscureText: true,
|
||||||
decoration: buildDecoration('Password', icon: Icons.password),
|
decoration: buildDecoration('Password', icon: Icons.password),
|
||||||
),
|
),
|
||||||
|
SizedBox(height: MediaQuery.of(context).size.height * 0.1),
|
||||||
|
loading
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
floatingActionButton: FloatingActionButton(
|
floatingActionButton: FloatingActionButton(
|
||||||
child: const Icon(Icons.send),
|
child: const Icon(Icons.save),
|
||||||
onPressed: () {
|
onPressed: () async {
|
||||||
final info = PrivateKeyInfo(
|
final name = nameController.text;
|
||||||
nameController.text, keyController.text, pwdController.text);
|
final key = keyController.text;
|
||||||
|
final pwd = pwdController.text;
|
||||||
|
if (name.isEmpty || key.isEmpty || pwd.isEmpty) {
|
||||||
|
showSnackBar(
|
||||||
|
context, const Text('Three fields must not be empty.'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
FocusScope.of(context).unfocus();
|
||||||
|
setState(() {
|
||||||
|
loading = const SizedBox(
|
||||||
|
height: 50,
|
||||||
|
child: Center(
|
||||||
|
child: CircularProgressIndicator(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
final info = PrivateKeyInfo(name, key, pwd);
|
||||||
|
bool haveErr = false;
|
||||||
|
try {
|
||||||
|
info.privateKey = await compute(decyptPem, [key, pwd]);
|
||||||
|
} catch (e) {
|
||||||
|
showSnackBar(context, Text(e.toString()));
|
||||||
|
haveErr = true;
|
||||||
|
} finally {
|
||||||
|
setState(() {
|
||||||
|
loading = const SizedBox();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (haveErr) return;
|
||||||
if (widget.info != null) {
|
if (widget.info != null) {
|
||||||
_provider.updateInfo(widget.info!, info);
|
_provider.updateInfo(widget.info!, info);
|
||||||
} else {
|
} else {
|
||||||
@@ -92,3 +127,11 @@ class _PrivateKeyEditPageState extends State<PrivateKeyEditPage>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// [args] : [key, pwd]
|
||||||
|
String decyptPem(List<String> args) {
|
||||||
|
/// skip when the key is not encrypted, or will throw exception
|
||||||
|
if (!SSHKeyPair.isEncryptedPem(args[0])) return args[0];
|
||||||
|
final sshKey = SSHKeyPair.fromPem(args[0], args[1]);
|
||||||
|
return sshKey.first.toPem();
|
||||||
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import 'package:provider/provider.dart';
|
|||||||
import 'package:toolbox/core/route.dart';
|
import 'package:toolbox/core/route.dart';
|
||||||
import 'package:toolbox/data/provider/private_key.dart';
|
import 'package:toolbox/data/provider/private_key.dart';
|
||||||
import 'package:toolbox/data/res/color.dart';
|
import 'package:toolbox/data/res/color.dart';
|
||||||
|
import 'package:toolbox/data/res/padding.dart';
|
||||||
import 'package:toolbox/view/page/private_key/edit.dart';
|
import 'package:toolbox/view/page/private_key/edit.dart';
|
||||||
import 'package:toolbox/view/widget/round_rect_card.dart';
|
import 'package:toolbox/view/widget/round_rect_card.dart';
|
||||||
|
|
||||||
@@ -29,24 +30,27 @@ class _PrivateKeyListState extends State<StoredPrivateKeysPage> {
|
|||||||
itemCount: key.infos.length,
|
itemCount: key.infos.length,
|
||||||
itemExtent: 57,
|
itemExtent: 57,
|
||||||
itemBuilder: (context, idx) {
|
itemBuilder: (context, idx) {
|
||||||
return RoundRectCard(Row(
|
return RoundRectCard(Padding(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
padding: roundRectCardPadding,
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
child: Row(
|
||||||
children: [
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
Text(
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
key.infos[idx].id,
|
children: [
|
||||||
textAlign: TextAlign.center,
|
Text(
|
||||||
),
|
key.infos[idx].id,
|
||||||
TextButton(
|
textAlign: TextAlign.center,
|
||||||
onPressed: () => AppRoute(
|
),
|
||||||
PrivateKeyEditPage(info: key.infos[idx]),
|
TextButton(
|
||||||
'private key edit page')
|
onPressed: () => AppRoute(
|
||||||
.go(context),
|
PrivateKeyEditPage(info: key.infos[idx]),
|
||||||
child: Text(
|
'private key edit page')
|
||||||
'Edit',
|
.go(context),
|
||||||
style: _textStyle,
|
child: Text(
|
||||||
))
|
'Edit',
|
||||||
],
|
style: _textStyle,
|
||||||
|
))
|
||||||
|
],
|
||||||
|
),
|
||||||
));
|
));
|
||||||
})
|
})
|
||||||
: const Center(child: Text('No saved private keys.'));
|
: const Center(child: Text('No saved private keys.'));
|
||||||
@@ -1,13 +1,12 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:toolbox/core/route.dart';
|
|
||||||
import 'package:toolbox/data/model/server/net_speed.dart';
|
import 'package:toolbox/data/model/server/net_speed.dart';
|
||||||
import 'package:toolbox/data/model/server/server.dart';
|
import 'package:toolbox/data/model/server/server.dart';
|
||||||
import 'package:toolbox/data/model/server/server_status.dart';
|
import 'package:toolbox/data/model/server/server_status.dart';
|
||||||
import 'package:toolbox/data/provider/server.dart';
|
import 'package:toolbox/data/provider/server.dart';
|
||||||
import 'package:toolbox/data/res/color.dart';
|
import 'package:toolbox/data/res/color.dart';
|
||||||
import 'package:toolbox/data/res/icon/linux_icons.dart';
|
import 'package:toolbox/data/res/icon/linux_icons.dart';
|
||||||
import 'package:toolbox/view/page/server/edit.dart';
|
import 'package:toolbox/data/res/padding.dart';
|
||||||
import 'package:toolbox/view/widget/round_rect_card.dart';
|
import 'package:toolbox/view/widget/round_rect_card.dart';
|
||||||
|
|
||||||
const style11 = TextStyle(fontSize: 11);
|
const style11 = TextStyle(fontSize: 11);
|
||||||
@@ -35,8 +34,8 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Consumer<ServerProvider>(builder: (_, provider, __) {
|
return Consumer<ServerProvider>(builder: (_, provider, __) {
|
||||||
return _buildMainPage(
|
return _buildMainPage(provider.servers
|
||||||
provider.servers.firstWhere((e) => e.client.id == widget.id));
|
.firstWhere((e) => '${e.info.ip}:${e.info.port}' == widget.id));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,15 +43,9 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
|||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Text(si.info.name),
|
title: Text(si.info.name),
|
||||||
actions: [IconButton(onPressed: () => AppRoute(
|
|
||||||
ServerEditPage(
|
|
||||||
spi: si.info,
|
|
||||||
),
|
|
||||||
'Edit server info page')
|
|
||||||
.go(context), icon: const Icon(Icons.edit))],
|
|
||||||
),
|
),
|
||||||
body: ListView(
|
body: ListView(
|
||||||
padding: const EdgeInsets.all(17),
|
padding: const EdgeInsets.all(13),
|
||||||
children: [
|
children: [
|
||||||
_buildLinuxIcon(si.status.sysVer),
|
_buildLinuxIcon(si.status.sysVer),
|
||||||
SizedBox(height: _media.size.height * 0.03),
|
SizedBox(height: _media.size.height * 0.03),
|
||||||
@@ -60,7 +53,8 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
|||||||
_buildCPUView(si.status),
|
_buildCPUView(si.status),
|
||||||
_buildDiskView(si.status),
|
_buildDiskView(si.status),
|
||||||
_buildMemView(si.status),
|
_buildMemView(si.status),
|
||||||
_buildNetView(si.status.netSpeed)
|
_buildNetView(si.status.netSpeed),
|
||||||
|
SizedBox(height: _media.padding.bottom),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -75,41 +69,44 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
|||||||
|
|
||||||
Widget _buildCPUView(ServerStatus ss) {
|
Widget _buildCPUView(ServerStatus ss) {
|
||||||
return RoundRectCard(
|
return RoundRectCard(
|
||||||
SizedBox(
|
Padding(
|
||||||
height: 12 * ss.cpu2Status.coresCount + 67,
|
padding: roundRectCardPadding,
|
||||||
child: Column(children: [
|
child: SizedBox(
|
||||||
SizedBox(
|
height: 12 * ss.cpu2Status.coresCount + 67,
|
||||||
height: _media.size.height * 0.02,
|
child: Column(children: [
|
||||||
),
|
SizedBox(
|
||||||
Row(
|
height: _media.size.height * 0.02,
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
),
|
||||||
children: [
|
Row(
|
||||||
Text(
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
'${ss.cpu2Status.usedPercent(coreIdx: 0).toInt()}%',
|
children: [
|
||||||
style: const TextStyle(fontSize: 27),
|
Text(
|
||||||
textScaleFactor: 1.0,
|
'${ss.cpu2Status.usedPercent(coreIdx: 0).toInt()}%',
|
||||||
),
|
style: const TextStyle(fontSize: 27),
|
||||||
Row(
|
textScaleFactor: 1.0,
|
||||||
children: [
|
),
|
||||||
_buildCPUTimePercent(ss.cpu2Status.user, 'user'),
|
Row(
|
||||||
SizedBox(
|
children: [
|
||||||
width: _media.size.width * 0.03,
|
_buildCPUTimePercent(ss.cpu2Status.user, 'user'),
|
||||||
),
|
SizedBox(
|
||||||
_buildCPUTimePercent(ss.cpu2Status.sys, 'sys'),
|
width: _media.size.width * 0.03,
|
||||||
SizedBox(
|
),
|
||||||
width: _media.size.width * 0.03,
|
_buildCPUTimePercent(ss.cpu2Status.sys, 'sys'),
|
||||||
),
|
SizedBox(
|
||||||
_buildCPUTimePercent(ss.cpu2Status.nice, 'nice'),
|
width: _media.size.width * 0.03,
|
||||||
SizedBox(
|
),
|
||||||
width: _media.size.width * 0.03,
|
_buildCPUTimePercent(ss.cpu2Status.nice, 'nice'),
|
||||||
),
|
SizedBox(
|
||||||
_buildCPUTimePercent(ss.cpu2Status.idle, 'idle')
|
width: _media.size.width * 0.03,
|
||||||
],
|
),
|
||||||
)
|
_buildCPUTimePercent(ss.cpu2Status.idle, 'idle')
|
||||||
],
|
],
|
||||||
),
|
)
|
||||||
_buildCPUProgress(ss)
|
],
|
||||||
]),
|
),
|
||||||
|
_buildCPUProgress(ss)
|
||||||
|
]),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -165,7 +162,7 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
|||||||
|
|
||||||
Widget _buildUpTimeAndSys(ServerStatus ss) {
|
Widget _buildUpTimeAndSys(ServerStatus ss) {
|
||||||
return RoundRectCard(Padding(
|
return RoundRectCard(Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 13),
|
padding: const EdgeInsets.symmetric(vertical: 13, horizontal: 17),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
@@ -180,54 +177,73 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String convertMB(int mb) {
|
||||||
|
const suffix = ['MB', 'GB', 'TB'];
|
||||||
|
double value = mb.toDouble();
|
||||||
|
int squareTimes = 0;
|
||||||
|
for (; value / 1024 > 1 && squareTimes < 3; squareTimes++) {
|
||||||
|
value /= 1024;
|
||||||
|
}
|
||||||
|
var finalValue = value.toStringAsFixed(1);
|
||||||
|
if (finalValue.endsWith('.0')) {
|
||||||
|
finalValue = finalValue.replaceFirst('.0', '');
|
||||||
|
}
|
||||||
|
return '$finalValue ${suffix[squareTimes]}';
|
||||||
|
}
|
||||||
|
|
||||||
Widget _buildMemView(ServerStatus ss) {
|
Widget _buildMemView(ServerStatus ss) {
|
||||||
final pColor = primaryColor;
|
final pColor = primaryColor;
|
||||||
final used = ss.memory.used / ss.memory.total;
|
final used = ss.memory.used / ss.memory.total;
|
||||||
final width = _media.size.width - 17 * 2 - 17 * 2;
|
final width = _media.size.width - 17 * 2 - 17 * 2;
|
||||||
return RoundRectCard(SizedBox(
|
return RoundRectCard(Padding(
|
||||||
height: 47,
|
padding: roundRectCardPadding,
|
||||||
child: Column(
|
child: SizedBox(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
height: 47,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
child: Column(
|
||||||
children: [
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
Row(
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
children: [
|
||||||
children: [
|
Row(
|
||||||
_buildMemExplain('Used', pColor),
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
_buildMemExplain('Cache', pColor.withAlpha(77)),
|
children: [
|
||||||
_buildMemExplain('Avail', progressColor.resolve(context))
|
_buildMemExplain(convertMB(ss.memory.used), pColor),
|
||||||
],
|
_buildMemExplain(
|
||||||
),
|
convertMB(ss.memory.cache), pColor.withAlpha(77)),
|
||||||
const SizedBox(
|
_buildMemExplain(convertMB(ss.memory.total - ss.memory.used),
|
||||||
height: 7,
|
progressColor.resolve(context))
|
||||||
),
|
],
|
||||||
Row(
|
),
|
||||||
children: [
|
const SizedBox(
|
||||||
SizedBox(
|
height: 7,
|
||||||
width: width * used,
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
width: width * used,
|
||||||
|
child: LinearProgressIndicator(
|
||||||
|
value: 1,
|
||||||
|
color: pColor,
|
||||||
|
)),
|
||||||
|
SizedBox(
|
||||||
|
width: width * (1 - used),
|
||||||
child: LinearProgressIndicator(
|
child: LinearProgressIndicator(
|
||||||
value: 1,
|
// memory.total == 1: failed to get mem, now mem = [emptyMemory] which is initial value.
|
||||||
color: pColor,
|
value: ss.memory.total == 1
|
||||||
)),
|
? 0
|
||||||
SizedBox(
|
: ss.memory.cache / (ss.memory.total - ss.memory.used),
|
||||||
width: width * (1 - used),
|
backgroundColor: progressColor.resolve(context),
|
||||||
child: LinearProgressIndicator(
|
color: pColor.withAlpha(77),
|
||||||
// memory.total == 1: failed to get mem, now mem = [emptyMemory] which is initial value.
|
),
|
||||||
value: ss.memory.total == 1
|
)
|
||||||
? 0
|
],
|
||||||
: ss.memory.cache / ss.memory.total,
|
)
|
||||||
backgroundColor: progressColor.resolve(context),
|
],
|
||||||
color: pColor.withAlpha(77),
|
),
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildMemExplain(String type, Color color) {
|
Widget _buildMemExplain(String value, Color color) {
|
||||||
return Row(
|
return Row(
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
@@ -236,7 +252,12 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
|||||||
width: 11,
|
width: 11,
|
||||||
),
|
),
|
||||||
const SizedBox(width: 4),
|
const SizedBox(width: 4),
|
||||||
Text(type, style: style11, textScaleFactor: 1.0)
|
Text(
|
||||||
|
value,
|
||||||
|
style: style11,
|
||||||
|
textScaleFactor: 1.0,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
)
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -251,7 +272,7 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
|||||||
return RoundRectCard(SizedBox(
|
return RoundRectCard(SizedBox(
|
||||||
height: 27 * clone.length + 25,
|
height: 27 * clone.length + 25,
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 13),
|
padding: const EdgeInsets.symmetric(vertical: 13, horizontal: 17),
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
itemCount: clone.length,
|
itemCount: clone.length,
|
||||||
itemBuilder: (_, idx) {
|
itemBuilder: (_, idx) {
|
||||||
@@ -288,7 +309,7 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
|||||||
];
|
];
|
||||||
children.addAll(ns.devices.map((e) => _buildNetSpeedItem(ns, e)));
|
children.addAll(ns.devices.map((e) => _buildNetSpeedItem(ns, e)));
|
||||||
return RoundRectCard(Padding(
|
return RoundRectCard(Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 7),
|
padding: const EdgeInsets.symmetric(vertical: 7, horizontal: 17),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: children,
|
children: children,
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import 'package:toolbox/data/model/server/server_private_info.dart';
|
|||||||
import 'package:toolbox/data/provider/private_key.dart';
|
import 'package:toolbox/data/provider/private_key.dart';
|
||||||
import 'package:toolbox/data/provider/server.dart';
|
import 'package:toolbox/data/provider/server.dart';
|
||||||
import 'package:toolbox/data/res/color.dart';
|
import 'package:toolbox/data/res/color.dart';
|
||||||
|
import 'package:toolbox/data/store/private_key.dart';
|
||||||
import 'package:toolbox/locator.dart';
|
import 'package:toolbox/locator.dart';
|
||||||
import 'package:toolbox/view/page/private_key/edit.dart';
|
import 'package:toolbox/view/page/private_key/edit.dart';
|
||||||
import 'package:toolbox/view/widget/input_decoration.dart';
|
import 'package:toolbox/view/widget/input_decoration.dart';
|
||||||
@@ -34,7 +35,7 @@ class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin {
|
|||||||
bool usePublicKey = false;
|
bool usePublicKey = false;
|
||||||
|
|
||||||
int _pubKeyIndex = -1;
|
int _pubKeyIndex = -1;
|
||||||
late PrivateKeyInfo _keyInfo;
|
PrivateKeyInfo? _keyInfo;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@@ -59,6 +60,7 @@ class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin {
|
|||||||
onPressed: () {
|
onPressed: () {
|
||||||
_serverProvider.delServer(widget.spi!);
|
_serverProvider.delServer(widget.spi!);
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
|
Navigator.of(context).pop();
|
||||||
},
|
},
|
||||||
child: const Text(
|
child: const Text(
|
||||||
'Yes',
|
'Yes',
|
||||||
@@ -187,10 +189,15 @@ class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin {
|
|||||||
if (portController.text == '') {
|
if (portController.text == '') {
|
||||||
portController.text = '22';
|
portController.text = '22';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (widget.spi != null && widget.spi!.pubKeyId != null) {
|
||||||
|
_keyInfo ??= locator<PrivateKeyStore>().get(widget.spi!.pubKeyId!);
|
||||||
|
}
|
||||||
|
|
||||||
final authorization = usePublicKey
|
final authorization = usePublicKey
|
||||||
? {
|
? {
|
||||||
"privateKey": _keyInfo.privateKey,
|
"privateKey": _keyInfo!.privateKey,
|
||||||
"passphrase": _keyInfo.password
|
"passphrase": _keyInfo!.password
|
||||||
}
|
}
|
||||||
: passwordController.text;
|
: passwordController.text;
|
||||||
final spi = ServerPrivateInfo(
|
final spi = ServerPrivateInfo(
|
||||||
@@ -199,7 +206,7 @@ class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin {
|
|||||||
port: int.parse(portController.text),
|
port: int.parse(portController.text),
|
||||||
user: usernameController.text,
|
user: usernameController.text,
|
||||||
authorization: authorization,
|
authorization: authorization,
|
||||||
pubKeyId: usePublicKey ? _keyInfo.id : null);
|
pubKeyId: usePublicKey ? _keyInfo!.id : null);
|
||||||
|
|
||||||
if (widget.spi == null) {
|
if (widget.spi == null) {
|
||||||
_serverProvider.addServer(spi);
|
_serverProvider.addServer(spi);
|
||||||
|
|||||||
@@ -1,19 +1,26 @@
|
|||||||
import 'package:after_layout/after_layout.dart';
|
import 'package:after_layout/after_layout.dart';
|
||||||
import 'package:circle_chart/circle_chart.dart';
|
import 'package:circle_chart/circle_chart.dart';
|
||||||
|
import 'package:dropdown_button2/dropdown_button2.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/widgets.dart';
|
|
||||||
import 'package:flutter_staggered_animations/flutter_staggered_animations.dart';
|
|
||||||
import 'package:get_it/get_it.dart';
|
import 'package:get_it/get_it.dart';
|
||||||
|
import 'package:marquee/marquee.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:pull_to_refresh/pull_to_refresh.dart';
|
||||||
import 'package:toolbox/core/route.dart';
|
import 'package:toolbox/core/route.dart';
|
||||||
|
import 'package:toolbox/core/utils.dart';
|
||||||
|
import 'package:toolbox/data/model/app/menu_item.dart';
|
||||||
import 'package:toolbox/data/model/server/server.dart';
|
import 'package:toolbox/data/model/server/server.dart';
|
||||||
import 'package:toolbox/data/model/server/server_connection_state.dart';
|
import 'package:toolbox/data/model/server/server_connection_state.dart';
|
||||||
|
import 'package:toolbox/data/model/server/server_private_info.dart';
|
||||||
import 'package:toolbox/data/model/server/server_status.dart';
|
import 'package:toolbox/data/model/server/server_status.dart';
|
||||||
import 'package:toolbox/data/provider/server.dart';
|
import 'package:toolbox/data/provider/server.dart';
|
||||||
|
import 'package:toolbox/data/res/color.dart';
|
||||||
import 'package:toolbox/data/store/setting.dart';
|
import 'package:toolbox/data/store/setting.dart';
|
||||||
import 'package:toolbox/locator.dart';
|
import 'package:toolbox/locator.dart';
|
||||||
import 'package:toolbox/view/page/server/detail.dart';
|
import 'package:toolbox/view/page/server/detail.dart';
|
||||||
import 'package:toolbox/view/page/server/edit.dart';
|
import 'package:toolbox/view/page/server/edit.dart';
|
||||||
|
import 'package:toolbox/view/page/snippet/list.dart';
|
||||||
|
import 'package:toolbox/view/widget/round_rect_card.dart';
|
||||||
|
|
||||||
class ServerPage extends StatefulWidget {
|
class ServerPage extends StatefulWidget {
|
||||||
const ServerPage({Key? key}) : super(key: key);
|
const ServerPage({Key? key}) : super(key: key);
|
||||||
@@ -27,6 +34,7 @@ class _ServerPageState extends State<ServerPage>
|
|||||||
late MediaQueryData _media;
|
late MediaQueryData _media;
|
||||||
late ThemeData _theme;
|
late ThemeData _theme;
|
||||||
late Color _primaryColor;
|
late Color _primaryColor;
|
||||||
|
late RefreshController _refreshController;
|
||||||
|
|
||||||
late ServerProvider _serverProvider;
|
late ServerProvider _serverProvider;
|
||||||
|
|
||||||
@@ -34,6 +42,7 @@ class _ServerPageState extends State<ServerPage>
|
|||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_serverProvider = locator<ServerProvider>();
|
_serverProvider = locator<ServerProvider>();
|
||||||
|
_refreshController = RefreshController();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -41,41 +50,48 @@ class _ServerPageState extends State<ServerPage>
|
|||||||
super.didChangeDependencies();
|
super.didChangeDependencies();
|
||||||
_media = MediaQuery.of(context);
|
_media = MediaQuery.of(context);
|
||||||
_theme = Theme.of(context);
|
_theme = Theme.of(context);
|
||||||
_primaryColor = Color(locator<SettingStore>().primaryColor.fetch()!);
|
_primaryColor = primaryColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
super.build(context);
|
super.build(context);
|
||||||
return Scaffold(
|
final autoUpdate =
|
||||||
body: Consumer<ServerProvider>(builder: (_, pro, __) {
|
locator<SettingStore>().serverStatusUpdateInterval.fetch() != 0;
|
||||||
if (pro.servers.isEmpty) {
|
final child = Consumer<ServerProvider>(builder: (_, pro, __) {
|
||||||
return const Center(
|
if (pro.servers.isEmpty) {
|
||||||
child: Text(
|
return const Center(
|
||||||
'There is no server.\nClick the fab to add one.',
|
child: Text(
|
||||||
textAlign: TextAlign.center,
|
'There is no server.\nClick the fab to add one.',
|
||||||
),
|
textAlign: TextAlign.center,
|
||||||
);
|
),
|
||||||
}
|
|
||||||
return SingleChildScrollView(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 7),
|
|
||||||
child: AnimationLimiter(
|
|
||||||
child: Column(
|
|
||||||
children: AnimationConfiguration.toStaggeredList(
|
|
||||||
duration: const Duration(milliseconds: 377),
|
|
||||||
childAnimationBuilder: (widget) => SlideAnimation(
|
|
||||||
verticalOffset: 50.0,
|
|
||||||
child: FadeInAnimation(
|
|
||||||
child: widget,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
children: [
|
|
||||||
const SizedBox(height: 13),
|
|
||||||
...pro.servers.map((e) => _buildEachServerCard(e))
|
|
||||||
],
|
|
||||||
))),
|
|
||||||
);
|
);
|
||||||
}),
|
}
|
||||||
|
return ListView.separated(
|
||||||
|
padding: const EdgeInsets.all(7),
|
||||||
|
itemBuilder: (ctx, idx) {
|
||||||
|
if (idx == pro.servers.length) {
|
||||||
|
return SizedBox(height: _media.padding.bottom);
|
||||||
|
}
|
||||||
|
return _buildEachServerCard(pro.servers[idx]);
|
||||||
|
},
|
||||||
|
itemCount: pro.servers.length + 1,
|
||||||
|
separatorBuilder: (_, __) => const SizedBox(
|
||||||
|
height: 3,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
return Scaffold(
|
||||||
|
body: autoUpdate
|
||||||
|
? child
|
||||||
|
: SmartRefresher(
|
||||||
|
controller: _refreshController,
|
||||||
|
child: child,
|
||||||
|
onRefresh: () async {
|
||||||
|
await _serverProvider.refreshData();
|
||||||
|
_refreshController.refreshCompleted();
|
||||||
|
},
|
||||||
|
),
|
||||||
floatingActionButton: FloatingActionButton(
|
floatingActionButton: FloatingActionButton(
|
||||||
onPressed: () =>
|
onPressed: () =>
|
||||||
AppRoute(const ServerEditPage(), 'Add server info page')
|
AppRoute(const ServerEditPage(), 'Add server info page')
|
||||||
@@ -88,112 +104,238 @@ class _ServerPageState extends State<ServerPage>
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildEachServerCard(ServerInfo si) {
|
Widget _buildEachServerCard(ServerInfo si) {
|
||||||
return Card(
|
return RoundRectCard(
|
||||||
child: InkWell(
|
InkWell(
|
||||||
onLongPress: () => AppRoute(
|
onLongPress: () => AppRoute(
|
||||||
ServerEditPage(
|
ServerEditPage(
|
||||||
spi: si.info,
|
spi: si.info,
|
||||||
),
|
),
|
||||||
'Edit server info page')
|
'Edit server info page')
|
||||||
.go(context),
|
.go(context),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(13),
|
padding: const EdgeInsets.all(13),
|
||||||
child:
|
child: _buildRealServerCard(
|
||||||
_buildRealServerCard(si.status, si.info.name, si.connectionState),
|
si.status, si.info.name, si.connectionState, si.info)),
|
||||||
),
|
onTap: () => AppRoute(ServerDetailPage('${si.info.ip}:${si.info.port}'),
|
||||||
onTap: () =>
|
'server detail page')
|
||||||
AppRoute(ServerDetailPage(si.client.id!), 'server detail page')
|
.go(context),
|
||||||
.go(context),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildRealServerCard(
|
Widget _buildRealServerCard(ServerStatus ss, String serverName,
|
||||||
ServerStatus ss, String serverName, ServerConnectionState cs) {
|
ServerConnectionState cs, ServerPrivateInfo spi) {
|
||||||
final rootDisk =
|
final rootDisk =
|
||||||
ss.disk.firstWhere((element) => element.mountLocation == '/');
|
ss.disk.firstWhere((element) => element.mountLocation == '/');
|
||||||
|
|
||||||
|
final topRightStr =
|
||||||
|
getTopRightStr(cs, ss.cpu2Status.temp, ss.uptime, ss.failedInfo);
|
||||||
|
final hasError =
|
||||||
|
cs == ServerConnectionState.failed && ss.failedInfo != null;
|
||||||
|
final style = TextStyle(
|
||||||
|
color: _theme.textTheme.bodyText1!.color!.withAlpha(100), fontSize: 11);
|
||||||
|
|
||||||
return Column(
|
return Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Row(
|
Padding(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
padding: const EdgeInsets.symmetric(horizontal: 7),
|
||||||
children: [
|
child: Row(
|
||||||
Text(
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
serverName,
|
children: [
|
||||||
style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 12),
|
Row(
|
||||||
textScaleFactor: 1.0,
|
children: [
|
||||||
),
|
Text(
|
||||||
Text(getTopRightStr(cs, ss.cpu2Status.temp, ss.uptime),
|
serverName,
|
||||||
textScaleFactor: 1.0,
|
style: const TextStyle(
|
||||||
style: TextStyle(
|
fontWeight: FontWeight.bold, fontSize: 12),
|
||||||
color: _theme.textTheme.bodyText1!.color!.withAlpha(100),
|
textScaleFactor: 1.0,
|
||||||
fontSize: 11))
|
),
|
||||||
],
|
const Icon(
|
||||||
|
Icons.keyboard_arrow_right,
|
||||||
|
size: 17,
|
||||||
|
color: Colors.grey,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
hasError
|
||||||
|
? ConstrainedBox(
|
||||||
|
constraints: BoxConstraints(
|
||||||
|
maxWidth: _media.size.width * 0.57,
|
||||||
|
maxHeight: 15),
|
||||||
|
child: Marquee(
|
||||||
|
accelerationDuration: const Duration(seconds: 3),
|
||||||
|
accelerationCurve: Curves.linear,
|
||||||
|
decelerationDuration: const Duration(seconds: 3),
|
||||||
|
decelerationCurve: Curves.linear,
|
||||||
|
text: topRightStr,
|
||||||
|
textScaleFactor: 1.0,
|
||||||
|
style: style),
|
||||||
|
)
|
||||||
|
: Text(topRightStr, style: style, textScaleFactor: 1.0),
|
||||||
|
DropdownButtonHideUnderline(
|
||||||
|
child: DropdownButton2(
|
||||||
|
customButton: const Padding(
|
||||||
|
padding: EdgeInsets.only(left: 7),
|
||||||
|
child: Icon(
|
||||||
|
Icons.more_vert,
|
||||||
|
size: 17,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
customItemsIndexes: const [3],
|
||||||
|
customItemsHeight: 8,
|
||||||
|
items: [
|
||||||
|
...MenuItems.firstItems.map(
|
||||||
|
(item) => DropdownMenuItem<MenuItem>(
|
||||||
|
value: item,
|
||||||
|
child: MenuItems.buildItem(item),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const DropdownMenuItem<Divider>(
|
||||||
|
enabled: false, child: Divider()),
|
||||||
|
...MenuItems.secondItems.map(
|
||||||
|
(item) => DropdownMenuItem<MenuItem>(
|
||||||
|
value: item,
|
||||||
|
child: MenuItems.buildItem(item),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
onChanged: (value) {
|
||||||
|
final item = value as MenuItem;
|
||||||
|
switch (item) {
|
||||||
|
case MenuItems.apt:
|
||||||
|
case MenuItems.sftp:
|
||||||
|
showSnackBar(
|
||||||
|
context, const Text('Now is not supported'));
|
||||||
|
break;
|
||||||
|
case MenuItems.snippet:
|
||||||
|
AppRoute(
|
||||||
|
SnippetListPage(
|
||||||
|
spi: spi,
|
||||||
|
),
|
||||||
|
'snippet list')
|
||||||
|
.go(context);
|
||||||
|
break;
|
||||||
|
case MenuItems.edit:
|
||||||
|
AppRoute(
|
||||||
|
ServerEditPage(
|
||||||
|
spi: spi,
|
||||||
|
),
|
||||||
|
'Edit server info page')
|
||||||
|
.go(context);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
itemHeight: 37,
|
||||||
|
itemPadding: const EdgeInsets.only(left: 17, right: 17),
|
||||||
|
dropdownWidth: 160,
|
||||||
|
dropdownPadding: const EdgeInsets.symmetric(vertical: 7),
|
||||||
|
dropdownDecoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(7),
|
||||||
|
),
|
||||||
|
dropdownElevation: 8,
|
||||||
|
offset: const Offset(0, 8),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 17,
|
height: 17,
|
||||||
),
|
),
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
children: [
|
children: [
|
||||||
_buildPercentCircle(ss.cpu2Status.usedPercent(), 'CPU'),
|
_buildPercentCircle(ss.cpu2Status.usedPercent()),
|
||||||
_buildPercentCircle(ss.memory.used / ss.memory.total * 100, 'Mem'),
|
_buildPercentCircle(ss.memory.used / ss.memory.total * 100),
|
||||||
_buildIOData('Net', 'Conn:\n' + ss.tcp.maxConn.toString(),
|
_buildIOData('Conn:\n' + ss.tcp.maxConn.toString(),
|
||||||
'Fail:\n' + ss.tcp.fail.toString()),
|
'Fail:\n' + ss.tcp.fail.toString()),
|
||||||
_buildIOData('Disk', 'Total:\n' + rootDisk.size,
|
_buildIOData('Total:\n' + rootDisk.size,
|
||||||
'Used:\n' + rootDisk.usedPercent.toString() + '%')
|
'Used:\n' + rootDisk.usedPercent.toString() + '%')
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
const SizedBox(height: 13),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
|
children: [
|
||||||
|
_buildExplainText('CPU'),
|
||||||
|
_buildExplainText('Mem'),
|
||||||
|
_buildExplainText('Net'),
|
||||||
|
_buildExplainText('Disk'),
|
||||||
|
],
|
||||||
|
)
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
String getTopRightStr(ServerConnectionState cs, String temp, String upTime) {
|
Widget _buildExplainText(String text) {
|
||||||
|
return SizedBox(
|
||||||
|
width: _media.size.width * 0.2,
|
||||||
|
child: Text(
|
||||||
|
text,
|
||||||
|
style: const TextStyle(fontSize: 12),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
textScaleFactor: 1.0,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
String getTopRightStr(ServerConnectionState cs, String temp, String upTime,
|
||||||
|
String? failedInfo) {
|
||||||
switch (cs) {
|
switch (cs) {
|
||||||
case ServerConnectionState.disconnected:
|
case ServerConnectionState.disconnected:
|
||||||
return 'Disconnected';
|
return 'Disconnected';
|
||||||
case ServerConnectionState.connected:
|
case ServerConnectionState.connected:
|
||||||
return temp == '' ? (upTime == '' ? 'Loading...' : upTime) : temp;
|
if (temp == '') {
|
||||||
|
if (upTime == '') {
|
||||||
|
return 'Loading...';
|
||||||
|
} else {
|
||||||
|
return upTime;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (upTime == '') {
|
||||||
|
return temp;
|
||||||
|
} else {
|
||||||
|
return '$temp | $upTime';
|
||||||
|
}
|
||||||
|
}
|
||||||
case ServerConnectionState.connecting:
|
case ServerConnectionState.connecting:
|
||||||
return 'Connecting...';
|
return 'Connecting...';
|
||||||
case ServerConnectionState.failed:
|
case ServerConnectionState.failed:
|
||||||
return 'Failed';
|
if (failedInfo == null) {
|
||||||
|
return 'Failed';
|
||||||
|
}
|
||||||
|
if (failedInfo.contains('encypted')) {
|
||||||
|
return 'Please "save" this private key again.';
|
||||||
|
}
|
||||||
|
return failedInfo;
|
||||||
default:
|
default:
|
||||||
return 'Unknown State';
|
return 'Unknown State';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildIOData(String title, String up, String down) {
|
Widget _buildIOData(String up, String down) {
|
||||||
final statusTextStyle = TextStyle(
|
final statusTextStyle = TextStyle(
|
||||||
fontSize: 9, color: _theme.textTheme.bodyText1!.color!.withAlpha(177));
|
fontSize: 9, color: _theme.textTheme.bodyText1!.color!.withAlpha(177));
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
width: _media.size.width * 0.2,
|
width: _media.size.width * 0.2,
|
||||||
height: _media.size.height * 0.1,
|
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
children: [
|
||||||
const SizedBox(),
|
const SizedBox(height: 5),
|
||||||
Column(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
up,
|
|
||||||
style: statusTextStyle,
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
textScaleFactor: 1.0,
|
|
||||||
),
|
|
||||||
const SizedBox(height: 3),
|
|
||||||
Text(
|
|
||||||
down + '\n',
|
|
||||||
style: statusTextStyle,
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
textScaleFactor: 1.0,
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Text(
|
Text(
|
||||||
title,
|
up,
|
||||||
style: const TextStyle(fontSize: 12),
|
style: statusTextStyle,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
textScaleFactor: 1.0,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 3),
|
||||||
|
Text(
|
||||||
|
down,
|
||||||
|
style: statusTextStyle,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
textScaleFactor: 1.0,
|
textScaleFactor: 1.0,
|
||||||
)
|
)
|
||||||
@@ -202,41 +344,31 @@ class _ServerPageState extends State<ServerPage>
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildPercentCircle(double percent, String title) {
|
Widget _buildPercentCircle(double percent) {
|
||||||
if (percent <= 0) percent = 0.01;
|
if (percent <= 0) percent = 0.01;
|
||||||
if (percent >= 100) percent = 99.9;
|
if (percent >= 100) percent = 99.9;
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
width: _media.size.width * 0.2,
|
width: _media.size.width * 0.2,
|
||||||
height: _media.size.height * 0.1,
|
child: Stack(
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
children: [
|
||||||
Stack(
|
Center(
|
||||||
children: [
|
child: CircleChart(
|
||||||
CircleChart(
|
progressColor: _primaryColor,
|
||||||
progressColor: _primaryColor,
|
progressNumber: percent,
|
||||||
progressNumber: percent,
|
maxNumber: 100,
|
||||||
maxNumber: 100,
|
width: 53,
|
||||||
width: _media.size.width * 0.37,
|
height: 53,
|
||||||
height: _media.size.height * 0.09,
|
),
|
||||||
),
|
|
||||||
Positioned.fill(
|
|
||||||
child: Center(
|
|
||||||
child: Text(
|
|
||||||
'${percent.toStringAsFixed(1)}%',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: const TextStyle(fontSize: 11),
|
|
||||||
textScaleFactor: 1.0,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
Text(
|
Positioned.fill(
|
||||||
title,
|
child: Center(
|
||||||
style: const TextStyle(fontSize: 12),
|
child: Text(
|
||||||
textAlign: TextAlign.center,
|
'${percent.toStringAsFixed(1)}%',
|
||||||
textScaleFactor: 1.0,
|
textAlign: TextAlign.center,
|
||||||
|
style: const TextStyle(fontSize: 11),
|
||||||
|
textScaleFactor: 1.0,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -251,6 +383,6 @@ class _ServerPageState extends State<ServerPage>
|
|||||||
await GetIt.I.allReady();
|
await GetIt.I.allReady();
|
||||||
await _serverProvider.loadLocalData();
|
await _serverProvider.loadLocalData();
|
||||||
await _serverProvider.refreshData();
|
await _serverProvider.refreshData();
|
||||||
await _serverProvider.startAutoRefresh();
|
_serverProvider.startAutoRefresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,13 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_material_color_picker/flutter_material_color_picker.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/provider/server.dart';
|
||||||
|
import 'package:toolbox/data/res/build_data.dart';
|
||||||
import 'package:toolbox/data/res/color.dart';
|
import 'package:toolbox/data/res/color.dart';
|
||||||
|
import 'package:toolbox/data/res/padding.dart';
|
||||||
|
import 'package:toolbox/data/res/tab.dart';
|
||||||
import 'package:toolbox/data/store/setting.dart';
|
import 'package:toolbox/data/store/setting.dart';
|
||||||
import 'package:toolbox/locator.dart';
|
import 'package:toolbox/locator.dart';
|
||||||
import 'package:toolbox/view/widget/round_rect_card.dart';
|
import 'package:toolbox/view/widget/round_rect_card.dart';
|
||||||
@@ -15,19 +22,28 @@ class SettingPage extends StatefulWidget {
|
|||||||
class _SettingPageState extends State<SettingPage> {
|
class _SettingPageState extends State<SettingPage> {
|
||||||
late SettingStore _store;
|
late SettingStore _store;
|
||||||
late int _selectedColorValue;
|
late int _selectedColorValue;
|
||||||
|
late int _launchPageIdx;
|
||||||
double _intervalValue = 0;
|
double _intervalValue = 0;
|
||||||
late Color priColor;
|
late Color priColor;
|
||||||
|
static const textStyle = TextStyle(fontSize: 14);
|
||||||
|
late final ServerProvider _serverProvider;
|
||||||
|
late MediaQueryData _media;
|
||||||
|
late ThemeData _theme;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void didChangeDependencies() {
|
void didChangeDependencies() {
|
||||||
super.didChangeDependencies();
|
super.didChangeDependencies();
|
||||||
priColor = primaryColor;
|
priColor = primaryColor;
|
||||||
|
_media = MediaQuery.of(context);
|
||||||
|
_theme = Theme.of(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
_serverProvider = locator<ServerProvider>();
|
||||||
_store = locator<SettingStore>();
|
_store = locator<SettingStore>();
|
||||||
|
_launchPageIdx = _store.launchPage.fetch()!;
|
||||||
_intervalValue = _store.serverStatusUpdateInterval.fetch()!.toDouble();
|
_intervalValue = _store.serverStatusUpdateInterval.fetch()!.toDouble();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,61 +56,95 @@ class _SettingPageState extends State<SettingPage> {
|
|||||||
body: ListView(
|
body: ListView(
|
||||||
padding: const EdgeInsets.all(17),
|
padding: const EdgeInsets.all(17),
|
||||||
children: [
|
children: [
|
||||||
RoundRectCard(_buildAppColorPreview()),
|
_buildAppColorPreview(),
|
||||||
RoundRectCard(
|
_buildUpdateInterval(),
|
||||||
ExpansionTile(
|
_buildCheckUpdate(),
|
||||||
tilePadding: EdgeInsets.zero,
|
_buildLaunchPage()
|
||||||
childrenPadding: EdgeInsets.zero,
|
].map((e) => RoundRectCard(e)).toList(),
|
||||||
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 _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: roundRectCardPadding,
|
||||||
|
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: roundRectCardPadding,
|
||||||
|
childrenPadding: roundRectCardPadding,
|
||||||
|
textColor: priColor,
|
||||||
|
title: const Text(
|
||||||
|
'Server status update interval',
|
||||||
|
style: textStyle,
|
||||||
|
textAlign: TextAlign.start,
|
||||||
|
),
|
||||||
|
subtitle: const Text(
|
||||||
|
'Will take effect immediately.',
|
||||||
|
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());
|
||||||
|
_serverProvider.startAutoRefresh();
|
||||||
|
},
|
||||||
|
label: '${_intervalValue.toInt()} seconds',
|
||||||
|
divisions: 10,
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 3,
|
||||||
|
),
|
||||||
|
_intervalValue == 0.0
|
||||||
|
? const Text(
|
||||||
|
'You set to 0, will not update automatically.\nYou can pull to refresh manually.',
|
||||||
|
style: TextStyle(color: Colors.grey),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
)
|
||||||
|
: const SizedBox(),
|
||||||
|
const SizedBox(
|
||||||
|
height: 13,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Widget _buildAppColorPreview() {
|
Widget _buildAppColorPreview() {
|
||||||
return ExpansionTile(
|
return ExpansionTile(
|
||||||
textColor: priColor,
|
textColor: priColor,
|
||||||
tilePadding: EdgeInsets.zero,
|
tilePadding: roundRectCardPadding,
|
||||||
childrenPadding: EdgeInsets.zero,
|
childrenPadding: roundRectCardPadding,
|
||||||
children: [
|
children: [
|
||||||
_buildAppColorPicker(priColor),
|
_buildAppColorPicker(priColor),
|
||||||
_buildColorPickerConfirmBtn()
|
_buildColorPickerConfirmBtn()
|
||||||
@@ -108,7 +158,7 @@ class _SettingPageState extends State<SettingPage> {
|
|||||||
),
|
),
|
||||||
title: const Text(
|
title: const Text(
|
||||||
'App primary color',
|
'App primary color',
|
||||||
style: TextStyle(fontSize: 14),
|
style: textStyle,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,4 +180,49 @@ class _SettingPageState extends State<SettingPage> {
|
|||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget _buildLaunchPage() {
|
||||||
|
return ExpansionTile(
|
||||||
|
textColor: priColor,
|
||||||
|
tilePadding: roundRectCardPadding,
|
||||||
|
childrenPadding: roundRectCardPadding,
|
||||||
|
title: const Text(
|
||||||
|
'Launch page',
|
||||||
|
style: textStyle,
|
||||||
|
),
|
||||||
|
trailing: ConstrainedBox(
|
||||||
|
constraints: BoxConstraints(maxWidth: _media.size.width * 0.35),
|
||||||
|
child: Text(
|
||||||
|
tabs[_launchPageIdx],
|
||||||
|
style: textStyle,
|
||||||
|
textAlign: TextAlign.right,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
children: tabs
|
||||||
|
.map((e) => ListTile(
|
||||||
|
contentPadding: EdgeInsets.zero,
|
||||||
|
title: Text(
|
||||||
|
e,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 14,
|
||||||
|
color: _theme.textTheme.bodyText2!.color!.withAlpha(177)),
|
||||||
|
),
|
||||||
|
trailing: _buildRadio(tabs.indexOf(e)),
|
||||||
|
))
|
||||||
|
.toList(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Radio _buildRadio(int index) {
|
||||||
|
return Radio<int>(
|
||||||
|
value: index,
|
||||||
|
groupValue: _launchPageIdx,
|
||||||
|
onChanged: (int? value) {
|
||||||
|
setState(() {
|
||||||
|
_launchPageIdx = value!;
|
||||||
|
_store.launchPage.put(value);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,91 @@
|
|||||||
|
import 'package:after_layout/after_layout.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:toolbox/core/utils.dart';
|
||||||
|
import 'package:toolbox/data/model/server/snippet.dart';
|
||||||
|
import 'package:toolbox/data/provider/snippet.dart';
|
||||||
|
import 'package:toolbox/locator.dart';
|
||||||
|
import 'package:toolbox/view/widget/input_decoration.dart';
|
||||||
|
|
||||||
class SnippetEditPage extends StatefulWidget {
|
class SnippetEditPage extends StatefulWidget {
|
||||||
const SnippetEditPage({Key? key}) : super(key: key);
|
const SnippetEditPage({Key? key, this.snippet}) : super(key: key);
|
||||||
|
|
||||||
|
final Snippet? snippet;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_SnippetEditPageState createState() => _SnippetEditPageState();
|
_SnippetEditPageState createState() => _SnippetEditPageState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _SnippetEditPageState extends State<SnippetEditPage> {
|
class _SnippetEditPageState extends State<SnippetEditPage>
|
||||||
|
with AfterLayoutMixin {
|
||||||
|
final nameController = TextEditingController();
|
||||||
|
final scriptController = TextEditingController();
|
||||||
|
|
||||||
|
late SnippetProvider _provider;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
_provider = locator<SnippetProvider>();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container();
|
return Scaffold(
|
||||||
|
appBar: AppBar(title: const Text('Edit'), actions: [
|
||||||
|
widget.snippet != null
|
||||||
|
? IconButton(
|
||||||
|
onPressed: () {
|
||||||
|
_provider.delInfo(widget.snippet!);
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
icon: const Icon(Icons.delete))
|
||||||
|
: const SizedBox()
|
||||||
|
]),
|
||||||
|
body: ListView(
|
||||||
|
padding: const EdgeInsets.all(13),
|
||||||
|
children: [
|
||||||
|
TextField(
|
||||||
|
controller: nameController,
|
||||||
|
keyboardType: TextInputType.text,
|
||||||
|
decoration: buildDecoration('Name', icon: Icons.info),
|
||||||
|
),
|
||||||
|
TextField(
|
||||||
|
controller: scriptController,
|
||||||
|
autocorrect: false,
|
||||||
|
minLines: 3,
|
||||||
|
maxLines: 10,
|
||||||
|
keyboardType: TextInputType.text,
|
||||||
|
enableSuggestions: false,
|
||||||
|
decoration: buildDecoration('Snippet', icon: Icons.code),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
floatingActionButton: FloatingActionButton(
|
||||||
|
child: const Icon(Icons.send),
|
||||||
|
onPressed: () {
|
||||||
|
final name = nameController.text;
|
||||||
|
final script = scriptController.text;
|
||||||
|
if (name.isEmpty || script.isEmpty) {
|
||||||
|
showSnackBar(context, const Text('Two fields must not be empty.'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final snippet = Snippet(name, script);
|
||||||
|
if (widget.snippet != null) {
|
||||||
|
_provider.updateInfo(widget.snippet!, snippet);
|
||||||
|
} else {
|
||||||
|
_provider.addInfo(snippet);
|
||||||
|
}
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void afterFirstLayout(BuildContext context) {
|
||||||
|
if (widget.snippet != null) {
|
||||||
|
nameController.text = widget.snippet!.name;
|
||||||
|
scriptController.text = widget.snippet!.script;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,157 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:toolbox/core/route.dart';
|
||||||
|
import 'package:toolbox/core/utils.dart';
|
||||||
|
import 'package:toolbox/data/model/server/server_private_info.dart';
|
||||||
|
import 'package:toolbox/data/model/server/snippet.dart';
|
||||||
|
import 'package:toolbox/data/provider/server.dart';
|
||||||
|
import 'package:toolbox/data/provider/snippet.dart';
|
||||||
|
import 'package:toolbox/data/res/color.dart';
|
||||||
|
import 'package:toolbox/data/res/padding.dart';
|
||||||
|
import 'package:toolbox/locator.dart';
|
||||||
|
import 'package:toolbox/view/page/snippet/edit.dart';
|
||||||
|
import 'package:toolbox/view/widget/round_rect_card.dart';
|
||||||
|
|
||||||
class SnippetListPage extends StatefulWidget {
|
class SnippetListPage extends StatefulWidget {
|
||||||
const SnippetListPage({Key? key}) : super(key: key);
|
const SnippetListPage({Key? key, this.spi}) : super(key: key);
|
||||||
|
final ServerPrivateInfo? spi;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_SnippetListPageState createState() => _SnippetListPageState();
|
_SnippetListPageState createState() => _SnippetListPageState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _SnippetListPageState extends State<SnippetListPage> {
|
class _SnippetListPageState extends State<SnippetListPage> {
|
||||||
|
late ServerPrivateInfo _selectedIndex;
|
||||||
|
|
||||||
|
final _textStyle = TextStyle(color: primaryColor);
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container();
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
title: const Text('Snippet List'),
|
||||||
|
),
|
||||||
|
body: _buildBody(),
|
||||||
|
floatingActionButton: FloatingActionButton(
|
||||||
|
child: const Icon(Icons.add),
|
||||||
|
onPressed: () =>
|
||||||
|
AppRoute(const SnippetEditPage(), 'snippet edit page').go(context),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildBody() {
|
||||||
|
return Consumer<SnippetProvider>(
|
||||||
|
builder: (_, key, __) {
|
||||||
|
return key.snippets.isNotEmpty
|
||||||
|
? ListView.builder(
|
||||||
|
padding: const EdgeInsets.all(13),
|
||||||
|
itemCount: key.snippets.length,
|
||||||
|
itemExtent: 57,
|
||||||
|
itemBuilder: (context, idx) {
|
||||||
|
return RoundRectCard(Padding(
|
||||||
|
padding: roundRectCardPadding,
|
||||||
|
child: Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
key.snippets[idx].name,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
Row(children: [
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => AppRoute(
|
||||||
|
SnippetEditPage(
|
||||||
|
snippet: key.snippets[idx]),
|
||||||
|
'snippet edit page')
|
||||||
|
.go(context),
|
||||||
|
child: Text(
|
||||||
|
'Edit',
|
||||||
|
style: _textStyle,
|
||||||
|
)),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () {
|
||||||
|
final snippet = key.snippets[idx];
|
||||||
|
if (widget.spi == null) {
|
||||||
|
_showRunDialog(snippet);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
run(context, snippet);
|
||||||
|
},
|
||||||
|
child: Text(
|
||||||
|
'Run',
|
||||||
|
style: _textStyle,
|
||||||
|
))
|
||||||
|
])
|
||||||
|
],
|
||||||
|
),
|
||||||
|
));
|
||||||
|
})
|
||||||
|
: const Center(child: Text('No saved snippets.'));
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _showRunDialog(Snippet snippet) {
|
||||||
|
showRoundDialog(context, 'Choose destination',
|
||||||
|
Consumer<ServerProvider>(builder: (_, provider, __) {
|
||||||
|
if (provider.servers.isEmpty) {
|
||||||
|
return const Text('No server available');
|
||||||
|
}
|
||||||
|
_selectedIndex = provider.servers.first.info;
|
||||||
|
return SizedBox(
|
||||||
|
height: 111,
|
||||||
|
child: Stack(children: [
|
||||||
|
Positioned(
|
||||||
|
child: Container(
|
||||||
|
height: 37,
|
||||||
|
decoration: const BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.all(Radius.circular(7)),
|
||||||
|
color: Colors.black12,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
top: 36,
|
||||||
|
bottom: 36,
|
||||||
|
left: 0,
|
||||||
|
right: 0,
|
||||||
|
),
|
||||||
|
ListWheelScrollView.useDelegate(
|
||||||
|
itemExtent: 37,
|
||||||
|
diameterRatio: 1.2,
|
||||||
|
controller: FixedExtentScrollController(initialItem: 0),
|
||||||
|
onSelectedItemChanged: (idx) =>
|
||||||
|
_selectedIndex = provider.servers[idx].info,
|
||||||
|
physics: const FixedExtentScrollPhysics(),
|
||||||
|
childDelegate: ListWheelChildBuilderDelegate(
|
||||||
|
builder: (context, index) => Center(
|
||||||
|
child: Text(
|
||||||
|
provider.servers[index].info.name,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
childCount: provider.servers.length),
|
||||||
|
)
|
||||||
|
]));
|
||||||
|
}), [
|
||||||
|
TextButton(
|
||||||
|
onPressed: () async => run(context, snippet),
|
||||||
|
child: const Text('Run')),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
child: const Text('Cancel')),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> run(BuildContext context, Snippet snippet) async {
|
||||||
|
final result = await locator<ServerProvider>()
|
||||||
|
.runSnippet(widget.spi ?? _selectedIndex, snippet);
|
||||||
|
if (result != null) {
|
||||||
|
showRoundDialog(context, 'Result',
|
||||||
|
Text(result, style: const TextStyle(fontSize: 13)), [
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
child: const Text('Close'))
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
17
lib/view/widget/input_field.dart
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:toolbox/view/widget/round_rect_card.dart';
|
||||||
|
|
||||||
|
Widget buildInput(BuildContext context, TextEditingController controller,
|
||||||
|
{int maxLines = 20, String? hint}) {
|
||||||
|
return RoundRectCard(
|
||||||
|
TextField(
|
||||||
|
maxLines: maxLines,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
fillColor: Theme.of(context).cardColor,
|
||||||
|
hintText: hint,
|
||||||
|
filled: true,
|
||||||
|
border: InputBorder.none),
|
||||||
|
controller: controller,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -8,11 +8,8 @@ class RoundRectCard extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Card(
|
return Card(
|
||||||
child: Padding(
|
child: child,
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 17),
|
clipBehavior: Clip.antiAlias,
|
||||||
child: child,
|
|
||||||
),
|
|
||||||
margin: const EdgeInsets.symmetric(vertical: 7),
|
|
||||||
shape: const RoundedRectangleBorder(
|
shape: const RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.all(Radius.circular(17))),
|
borderRadius: BorderRadius.all(Radius.circular(17))),
|
||||||
);
|
);
|
||||||
|
|||||||
1
linux/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
flutter/ephemeral
|
||||||
116
linux/CMakeLists.txt
Normal file
@@ -0,0 +1,116 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.10)
|
||||||
|
project(runner LANGUAGES CXX)
|
||||||
|
|
||||||
|
set(BINARY_NAME "toolbox")
|
||||||
|
set(APPLICATION_ID "tech.lolli.toolbox")
|
||||||
|
|
||||||
|
cmake_policy(SET CMP0063 NEW)
|
||||||
|
|
||||||
|
set(CMAKE_INSTALL_RPATH "$ORIGIN/lib")
|
||||||
|
|
||||||
|
# Root filesystem for cross-building.
|
||||||
|
if(FLUTTER_TARGET_PLATFORM_SYSROOT)
|
||||||
|
set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT})
|
||||||
|
set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT})
|
||||||
|
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||||
|
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
|
||||||
|
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||||
|
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Configure build options.
|
||||||
|
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||||
|
set(CMAKE_BUILD_TYPE "Debug" CACHE
|
||||||
|
STRING "Flutter build mode" FORCE)
|
||||||
|
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
|
||||||
|
"Debug" "Profile" "Release")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Compilation settings that should be applied to most targets.
|
||||||
|
function(APPLY_STANDARD_SETTINGS TARGET)
|
||||||
|
target_compile_features(${TARGET} PUBLIC cxx_std_14)
|
||||||
|
target_compile_options(${TARGET} PRIVATE -Wall -Werror)
|
||||||
|
target_compile_options(${TARGET} PRIVATE "$<$<NOT:$<CONFIG:Debug>>:-O3>")
|
||||||
|
target_compile_definitions(${TARGET} PRIVATE "$<$<NOT:$<CONFIG:Debug>>:NDEBUG>")
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter")
|
||||||
|
|
||||||
|
# Flutter library and tool build rules.
|
||||||
|
add_subdirectory(${FLUTTER_MANAGED_DIR})
|
||||||
|
|
||||||
|
# System-level dependencies.
|
||||||
|
find_package(PkgConfig REQUIRED)
|
||||||
|
pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)
|
||||||
|
|
||||||
|
add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}")
|
||||||
|
|
||||||
|
# Application build
|
||||||
|
add_executable(${BINARY_NAME}
|
||||||
|
"main.cc"
|
||||||
|
"my_application.cc"
|
||||||
|
"${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
|
||||||
|
)
|
||||||
|
apply_standard_settings(${BINARY_NAME})
|
||||||
|
target_link_libraries(${BINARY_NAME} PRIVATE flutter)
|
||||||
|
target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK)
|
||||||
|
add_dependencies(${BINARY_NAME} flutter_assemble)
|
||||||
|
# Only the install-generated bundle's copy of the executable will launch
|
||||||
|
# correctly, since the resources must in the right relative locations. To avoid
|
||||||
|
# people trying to run the unbundled copy, put it in a subdirectory instead of
|
||||||
|
# the default top-level location.
|
||||||
|
set_target_properties(${BINARY_NAME}
|
||||||
|
PROPERTIES
|
||||||
|
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Generated plugin build rules, which manage building the plugins and adding
|
||||||
|
# them to the application.
|
||||||
|
include(flutter/generated_plugins.cmake)
|
||||||
|
|
||||||
|
|
||||||
|
# === Installation ===
|
||||||
|
# By default, "installing" just makes a relocatable bundle in the build
|
||||||
|
# directory.
|
||||||
|
set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle")
|
||||||
|
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
||||||
|
set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Start with a clean build bundle directory every time.
|
||||||
|
install(CODE "
|
||||||
|
file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\")
|
||||||
|
" COMPONENT Runtime)
|
||||||
|
|
||||||
|
set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data")
|
||||||
|
set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib")
|
||||||
|
|
||||||
|
install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}"
|
||||||
|
COMPONENT Runtime)
|
||||||
|
|
||||||
|
install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
|
||||||
|
COMPONENT Runtime)
|
||||||
|
|
||||||
|
install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
|
||||||
|
COMPONENT Runtime)
|
||||||
|
|
||||||
|
if(PLUGIN_BUNDLED_LIBRARIES)
|
||||||
|
install(FILES "${PLUGIN_BUNDLED_LIBRARIES}"
|
||||||
|
DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
|
||||||
|
COMPONENT Runtime)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Fully re-copy the assets directory on each build to avoid having stale files
|
||||||
|
# from a previous install.
|
||||||
|
set(FLUTTER_ASSET_DIR_NAME "flutter_assets")
|
||||||
|
install(CODE "
|
||||||
|
file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\")
|
||||||
|
" COMPONENT Runtime)
|
||||||
|
install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}"
|
||||||
|
DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime)
|
||||||
|
|
||||||
|
# Install the AOT library on non-Debug builds only.
|
||||||
|
if(NOT CMAKE_BUILD_TYPE MATCHES "Debug")
|
||||||
|
install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
|
||||||
|
COMPONENT Runtime)
|
||||||
|
endif()
|
||||||
87
linux/flutter/CMakeLists.txt
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.10)
|
||||||
|
|
||||||
|
set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral")
|
||||||
|
|
||||||
|
# Configuration provided via flutter tool.
|
||||||
|
include(${EPHEMERAL_DIR}/generated_config.cmake)
|
||||||
|
|
||||||
|
# TODO: Move the rest of this into files in ephemeral. See
|
||||||
|
# https://github.com/flutter/flutter/issues/57146.
|
||||||
|
|
||||||
|
# Serves the same purpose as list(TRANSFORM ... PREPEND ...),
|
||||||
|
# which isn't available in 3.10.
|
||||||
|
function(list_prepend LIST_NAME PREFIX)
|
||||||
|
set(NEW_LIST "")
|
||||||
|
foreach(element ${${LIST_NAME}})
|
||||||
|
list(APPEND NEW_LIST "${PREFIX}${element}")
|
||||||
|
endforeach(element)
|
||||||
|
set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
# === Flutter Library ===
|
||||||
|
# System-level dependencies.
|
||||||
|
find_package(PkgConfig REQUIRED)
|
||||||
|
pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)
|
||||||
|
pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0)
|
||||||
|
pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0)
|
||||||
|
|
||||||
|
set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so")
|
||||||
|
|
||||||
|
# Published to parent scope for install step.
|
||||||
|
set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE)
|
||||||
|
set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE)
|
||||||
|
set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE)
|
||||||
|
set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE)
|
||||||
|
|
||||||
|
list(APPEND FLUTTER_LIBRARY_HEADERS
|
||||||
|
"fl_basic_message_channel.h"
|
||||||
|
"fl_binary_codec.h"
|
||||||
|
"fl_binary_messenger.h"
|
||||||
|
"fl_dart_project.h"
|
||||||
|
"fl_engine.h"
|
||||||
|
"fl_json_message_codec.h"
|
||||||
|
"fl_json_method_codec.h"
|
||||||
|
"fl_message_codec.h"
|
||||||
|
"fl_method_call.h"
|
||||||
|
"fl_method_channel.h"
|
||||||
|
"fl_method_codec.h"
|
||||||
|
"fl_method_response.h"
|
||||||
|
"fl_plugin_registrar.h"
|
||||||
|
"fl_plugin_registry.h"
|
||||||
|
"fl_standard_message_codec.h"
|
||||||
|
"fl_standard_method_codec.h"
|
||||||
|
"fl_string_codec.h"
|
||||||
|
"fl_value.h"
|
||||||
|
"fl_view.h"
|
||||||
|
"flutter_linux.h"
|
||||||
|
)
|
||||||
|
list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/")
|
||||||
|
add_library(flutter INTERFACE)
|
||||||
|
target_include_directories(flutter INTERFACE
|
||||||
|
"${EPHEMERAL_DIR}"
|
||||||
|
)
|
||||||
|
target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}")
|
||||||
|
target_link_libraries(flutter INTERFACE
|
||||||
|
PkgConfig::GTK
|
||||||
|
PkgConfig::GLIB
|
||||||
|
PkgConfig::GIO
|
||||||
|
)
|
||||||
|
add_dependencies(flutter flutter_assemble)
|
||||||
|
|
||||||
|
# === Flutter tool backend ===
|
||||||
|
# _phony_ is a non-existent file to force this command to run every time,
|
||||||
|
# since currently there's no way to get a full input/output list from the
|
||||||
|
# flutter tool.
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS}
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/_phony_
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E env
|
||||||
|
${FLUTTER_TOOL_ENVIRONMENT}
|
||||||
|
"${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh"
|
||||||
|
${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE}
|
||||||
|
VERBATIM
|
||||||
|
)
|
||||||
|
add_custom_target(flutter_assemble DEPENDS
|
||||||
|
"${FLUTTER_LIBRARY}"
|
||||||
|
${FLUTTER_LIBRARY_HEADERS}
|
||||||
|
)
|
||||||
15
linux/flutter/generated_plugin_registrant.cc
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
//
|
||||||
|
// Generated file. Do not edit.
|
||||||
|
//
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
|
|
||||||
|
#include "generated_plugin_registrant.h"
|
||||||
|
|
||||||
|
#include <url_launcher_linux/url_launcher_plugin.h>
|
||||||
|
|
||||||
|
void fl_register_plugins(FlPluginRegistry* registry) {
|
||||||
|
g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar =
|
||||||
|
fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin");
|
||||||
|
url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar);
|
||||||
|
}
|
||||||
15
linux/flutter/generated_plugin_registrant.h
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
//
|
||||||
|
// Generated file. Do not edit.
|
||||||
|
//
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
|
|
||||||
|
#ifndef GENERATED_PLUGIN_REGISTRANT_
|
||||||
|
#define GENERATED_PLUGIN_REGISTRANT_
|
||||||
|
|
||||||
|
#include <flutter_linux/flutter_linux.h>
|
||||||
|
|
||||||
|
// Registers Flutter plugins.
|
||||||
|
void fl_register_plugins(FlPluginRegistry* registry);
|
||||||
|
|
||||||
|
#endif // GENERATED_PLUGIN_REGISTRANT_
|
||||||
16
linux/flutter/generated_plugins.cmake
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
#
|
||||||
|
# Generated file, do not edit.
|
||||||
|
#
|
||||||
|
|
||||||
|
list(APPEND FLUTTER_PLUGIN_LIST
|
||||||
|
url_launcher_linux
|
||||||
|
)
|
||||||
|
|
||||||
|
set(PLUGIN_BUNDLED_LIBRARIES)
|
||||||
|
|
||||||
|
foreach(plugin ${FLUTTER_PLUGIN_LIST})
|
||||||
|
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin})
|
||||||
|
target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
|
||||||
|
list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>)
|
||||||
|
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
|
||||||
|
endforeach(plugin)
|
||||||
6
linux/main.cc
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
#include "my_application.h"
|
||||||
|
|
||||||
|
int main(int argc, char** argv) {
|
||||||
|
g_autoptr(MyApplication) app = my_application_new();
|
||||||
|
return g_application_run(G_APPLICATION(app), argc, argv);
|
||||||
|
}
|
||||||
104
linux/my_application.cc
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
#include "my_application.h"
|
||||||
|
|
||||||
|
#include <flutter_linux/flutter_linux.h>
|
||||||
|
#ifdef GDK_WINDOWING_X11
|
||||||
|
#include <gdk/gdkx.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "flutter/generated_plugin_registrant.h"
|
||||||
|
|
||||||
|
struct _MyApplication {
|
||||||
|
GtkApplication parent_instance;
|
||||||
|
char** dart_entrypoint_arguments;
|
||||||
|
};
|
||||||
|
|
||||||
|
G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION)
|
||||||
|
|
||||||
|
// Implements GApplication::activate.
|
||||||
|
static void my_application_activate(GApplication* application) {
|
||||||
|
MyApplication* self = MY_APPLICATION(application);
|
||||||
|
GtkWindow* window =
|
||||||
|
GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application)));
|
||||||
|
|
||||||
|
// Use a header bar when running in GNOME as this is the common style used
|
||||||
|
// by applications and is the setup most users will be using (e.g. Ubuntu
|
||||||
|
// desktop).
|
||||||
|
// If running on X and not using GNOME then just use a traditional title bar
|
||||||
|
// in case the window manager does more exotic layout, e.g. tiling.
|
||||||
|
// If running on Wayland assume the header bar will work (may need changing
|
||||||
|
// if future cases occur).
|
||||||
|
gboolean use_header_bar = TRUE;
|
||||||
|
#ifdef GDK_WINDOWING_X11
|
||||||
|
GdkScreen* screen = gtk_window_get_screen(window);
|
||||||
|
if (GDK_IS_X11_SCREEN(screen)) {
|
||||||
|
const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen);
|
||||||
|
if (g_strcmp0(wm_name, "GNOME Shell") != 0) {
|
||||||
|
use_header_bar = FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
if (use_header_bar) {
|
||||||
|
GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new());
|
||||||
|
gtk_widget_show(GTK_WIDGET(header_bar));
|
||||||
|
gtk_header_bar_set_title(header_bar, "ServerBox");
|
||||||
|
gtk_header_bar_set_show_close_button(header_bar, TRUE);
|
||||||
|
gtk_window_set_titlebar(window, GTK_WIDGET(header_bar));
|
||||||
|
} else {
|
||||||
|
gtk_window_set_title(window, "ServerBox");
|
||||||
|
}
|
||||||
|
|
||||||
|
gtk_window_set_default_size(window, 1280, 720);
|
||||||
|
gtk_widget_show(GTK_WIDGET(window));
|
||||||
|
|
||||||
|
g_autoptr(FlDartProject) project = fl_dart_project_new();
|
||||||
|
fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments);
|
||||||
|
|
||||||
|
FlView* view = fl_view_new(project);
|
||||||
|
gtk_widget_show(GTK_WIDGET(view));
|
||||||
|
gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view));
|
||||||
|
|
||||||
|
fl_register_plugins(FL_PLUGIN_REGISTRY(view));
|
||||||
|
|
||||||
|
gtk_widget_grab_focus(GTK_WIDGET(view));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Implements GApplication::local_command_line.
|
||||||
|
static gboolean my_application_local_command_line(GApplication* application, gchar*** arguments, int* exit_status) {
|
||||||
|
MyApplication* self = MY_APPLICATION(application);
|
||||||
|
// Strip out the first argument as it is the binary name.
|
||||||
|
self->dart_entrypoint_arguments = g_strdupv(*arguments + 1);
|
||||||
|
|
||||||
|
g_autoptr(GError) error = nullptr;
|
||||||
|
if (!g_application_register(application, nullptr, &error)) {
|
||||||
|
g_warning("Failed to register: %s", error->message);
|
||||||
|
*exit_status = 1;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_application_activate(application);
|
||||||
|
*exit_status = 0;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Implements GObject::dispose.
|
||||||
|
static void my_application_dispose(GObject* object) {
|
||||||
|
MyApplication* self = MY_APPLICATION(object);
|
||||||
|
g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev);
|
||||||
|
G_OBJECT_CLASS(my_application_parent_class)->dispose(object);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void my_application_class_init(MyApplicationClass* klass) {
|
||||||
|
G_APPLICATION_CLASS(klass)->activate = my_application_activate;
|
||||||
|
G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line;
|
||||||
|
G_OBJECT_CLASS(klass)->dispose = my_application_dispose;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void my_application_init(MyApplication* self) {}
|
||||||
|
|
||||||
|
MyApplication* my_application_new() {
|
||||||
|
return MY_APPLICATION(g_object_new(my_application_get_type(),
|
||||||
|
"application-id", APPLICATION_ID,
|
||||||
|
"flags", G_APPLICATION_NON_UNIQUE,
|
||||||
|
nullptr));
|
||||||
|
}
|
||||||
18
linux/my_application.h
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
#ifndef FLUTTER_MY_APPLICATION_H_
|
||||||
|
#define FLUTTER_MY_APPLICATION_H_
|
||||||
|
|
||||||
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
|
G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION,
|
||||||
|
GtkApplication)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* my_application_new:
|
||||||
|
*
|
||||||
|
* Creates a new Flutter-based application.
|
||||||
|
*
|
||||||
|
* Returns: a new #MyApplication.
|
||||||
|
*/
|
||||||
|
MyApplication* my_application_new();
|
||||||
|
|
||||||
|
#endif // FLUTTER_MY_APPLICATION_H_
|
||||||
@@ -56,7 +56,7 @@
|
|||||||
11B144C2A4236173ED27E4BD /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
|
11B144C2A4236173ED27E4BD /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
|
||||||
333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = "<group>"; };
|
333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = "<group>"; };
|
||||||
335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = "<group>"; };
|
335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = "<group>"; };
|
||||||
33CC10ED2044A3C60003C045 /* toolbox.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = toolbox.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
33CC10ED2044A3C60003C045 /* ServerBox.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ServerBox.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||||
33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = "<group>"; };
|
33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = "<group>"; };
|
||||||
33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = "<group>"; };
|
33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = "<group>"; };
|
||||||
@@ -94,7 +94,6 @@
|
|||||||
4677EE1296857C03A50C6F9A /* Pods-Runner.release.xcconfig */,
|
4677EE1296857C03A50C6F9A /* Pods-Runner.release.xcconfig */,
|
||||||
11B144C2A4236173ED27E4BD /* Pods-Runner.profile.xcconfig */,
|
11B144C2A4236173ED27E4BD /* Pods-Runner.profile.xcconfig */,
|
||||||
);
|
);
|
||||||
name = Pods;
|
|
||||||
path = Pods;
|
path = Pods;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
@@ -123,7 +122,7 @@
|
|||||||
33CC10EE2044A3C60003C045 /* Products */ = {
|
33CC10EE2044A3C60003C045 /* Products */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
33CC10ED2044A3C60003C045 /* toolbox.app */,
|
33CC10ED2044A3C60003C045 /* ServerBox.app */,
|
||||||
);
|
);
|
||||||
name = Products;
|
name = Products;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@@ -193,7 +192,7 @@
|
|||||||
);
|
);
|
||||||
name = Runner;
|
name = Runner;
|
||||||
productName = Runner;
|
productName = Runner;
|
||||||
productReference = 33CC10ED2044A3C60003C045 /* toolbox.app */;
|
productReference = 33CC10ED2044A3C60003C045 /* ServerBox.app */;
|
||||||
productType = "com.apple.product-type.application";
|
productType = "com.apple.product-type.application";
|
||||||
};
|
};
|
||||||
/* End PBXNativeTarget section */
|
/* End PBXNativeTarget section */
|
||||||
@@ -421,11 +420,15 @@
|
|||||||
CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements;
|
CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
COMBINE_HIDPI_IMAGES = YES;
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
|
CURRENT_PROJECT_VERSION = 79;
|
||||||
|
DEVELOPMENT_TEAM = BA88US33G6;
|
||||||
INFOPLIST_FILE = Runner/Info.plist;
|
INFOPLIST_FILE = Runner/Info.plist;
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/../Frameworks",
|
"@executable_path/../Frameworks",
|
||||||
);
|
);
|
||||||
|
MARKETING_VERSION = 1.0.79;
|
||||||
|
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
||||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||||
SWIFT_VERSION = 5.0;
|
SWIFT_VERSION = 5.0;
|
||||||
};
|
};
|
||||||
@@ -547,11 +550,15 @@
|
|||||||
CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements;
|
CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
COMBINE_HIDPI_IMAGES = YES;
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
|
CURRENT_PROJECT_VERSION = 79;
|
||||||
|
DEVELOPMENT_TEAM = BA88US33G6;
|
||||||
INFOPLIST_FILE = Runner/Info.plist;
|
INFOPLIST_FILE = Runner/Info.plist;
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/../Frameworks",
|
"@executable_path/../Frameworks",
|
||||||
);
|
);
|
||||||
|
MARKETING_VERSION = 1.0.79;
|
||||||
|
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
||||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||||
SWIFT_VERSION = 5.0;
|
SWIFT_VERSION = 5.0;
|
||||||
@@ -567,11 +574,15 @@
|
|||||||
CODE_SIGN_ENTITLEMENTS = Runner/Release.entitlements;
|
CODE_SIGN_ENTITLEMENTS = Runner/Release.entitlements;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
COMBINE_HIDPI_IMAGES = YES;
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
|
CURRENT_PROJECT_VERSION = 79;
|
||||||
|
DEVELOPMENT_TEAM = BA88US33G6;
|
||||||
INFOPLIST_FILE = Runner/Info.plist;
|
INFOPLIST_FILE = Runner/Info.plist;
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/../Frameworks",
|
"@executable_path/../Frameworks",
|
||||||
);
|
);
|
||||||
|
MARKETING_VERSION = 1.0.79;
|
||||||
|
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
||||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||||
SWIFT_VERSION = 5.0;
|
SWIFT_VERSION = 5.0;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,64 +1,64 @@
|
|||||||
{
|
{
|
||||||
"images" : [
|
"images" : [
|
||||||
{
|
{
|
||||||
|
"idiom" : "mac",
|
||||||
"size" : "16x16",
|
"size" : "16x16",
|
||||||
"idiom" : "mac",
|
"scale" : "1x",
|
||||||
"filename" : "app_icon_16.png",
|
"filename" : "icon_16@1x.png"
|
||||||
"scale" : "1x"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"idiom" : "mac",
|
||||||
"size" : "16x16",
|
"size" : "16x16",
|
||||||
"idiom" : "mac",
|
"scale" : "2x",
|
||||||
"filename" : "app_icon_32.png",
|
"filename" : "icon_16@2x.png"
|
||||||
"scale" : "2x"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"idiom" : "mac",
|
||||||
"size" : "32x32",
|
"size" : "32x32",
|
||||||
"idiom" : "mac",
|
"scale" : "1x",
|
||||||
"filename" : "app_icon_32.png",
|
"filename" : "icon_32@1x.png"
|
||||||
"scale" : "1x"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"idiom" : "mac",
|
||||||
"size" : "32x32",
|
"size" : "32x32",
|
||||||
"idiom" : "mac",
|
"scale" : "2x",
|
||||||
"filename" : "app_icon_64.png",
|
"filename" : "icon_32@2x.png"
|
||||||
"scale" : "2x"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"idiom" : "mac",
|
||||||
"size" : "128x128",
|
"size" : "128x128",
|
||||||
"idiom" : "mac",
|
"scale" : "1x",
|
||||||
"filename" : "app_icon_128.png",
|
"filename" : "icon_128@1x.png"
|
||||||
"scale" : "1x"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"idiom" : "mac",
|
||||||
"size" : "128x128",
|
"size" : "128x128",
|
||||||
"idiom" : "mac",
|
"scale" : "2x",
|
||||||
"filename" : "app_icon_256.png",
|
"filename" : "icon_128@2x.png"
|
||||||
"scale" : "2x"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"idiom" : "mac",
|
||||||
"size" : "256x256",
|
"size" : "256x256",
|
||||||
"idiom" : "mac",
|
"scale" : "1x",
|
||||||
"filename" : "app_icon_256.png",
|
"filename" : "icon_256@1x.png"
|
||||||
"scale" : "1x"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"idiom" : "mac",
|
||||||
"size" : "256x256",
|
"size" : "256x256",
|
||||||
"idiom" : "mac",
|
"scale" : "2x",
|
||||||
"filename" : "app_icon_512.png",
|
"filename" : "icon_256@2x.png"
|
||||||
"scale" : "2x"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"size" : "512x512",
|
|
||||||
"idiom" : "mac",
|
"idiom" : "mac",
|
||||||
"filename" : "app_icon_512.png",
|
"size" : "512x512",
|
||||||
"scale" : "1x"
|
"scale" : "1x",
|
||||||
|
"filename" : "icon_512@1x.png"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"size" : "512x512",
|
|
||||||
"idiom" : "mac",
|
"idiom" : "mac",
|
||||||
"filename" : "app_icon_1024.png",
|
"size" : "512x512",
|
||||||
"scale" : "2x"
|
"scale" : "2x",
|
||||||
|
"filename" : "icon_512@2x.png"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"info" : {
|
"info" : {
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 46 KiB |
|
Before Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 5.8 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
BIN
macos/Runner/Assets.xcassets/AppIcon.appiconset/icon_128@1x.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
macos/Runner/Assets.xcassets/AppIcon.appiconset/icon_128@2x.png
Normal file
|
After Width: | Height: | Size: 36 KiB |
BIN
macos/Runner/Assets.xcassets/AppIcon.appiconset/icon_16@1x.png
Normal file
|
After Width: | Height: | Size: 743 B |
BIN
macos/Runner/Assets.xcassets/AppIcon.appiconset/icon_16@2x.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
macos/Runner/Assets.xcassets/AppIcon.appiconset/icon_256@1x.png
Normal file
|
After Width: | Height: | Size: 36 KiB |
BIN
macos/Runner/Assets.xcassets/AppIcon.appiconset/icon_256@2x.png
Normal file
|
After Width: | Height: | Size: 96 KiB |
BIN
macos/Runner/Assets.xcassets/AppIcon.appiconset/icon_32@1x.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
macos/Runner/Assets.xcassets/AppIcon.appiconset/icon_32@2x.png
Normal file
|
After Width: | Height: | Size: 4.6 KiB |
BIN
macos/Runner/Assets.xcassets/AppIcon.appiconset/icon_512@1x.png
Normal file
|
After Width: | Height: | Size: 96 KiB |
BIN
macos/Runner/Assets.xcassets/AppIcon.appiconset/icon_512@2x.png
Normal file
|
After Width: | Height: | Size: 377 KiB |
@@ -5,10 +5,10 @@
|
|||||||
// 'flutter create' template.
|
// 'flutter create' template.
|
||||||
|
|
||||||
// The application's name. By default this is also the title of the Flutter window.
|
// The application's name. By default this is also the title of the Flutter window.
|
||||||
PRODUCT_NAME = toolbox
|
PRODUCT_NAME = ServerBox
|
||||||
|
|
||||||
// The application's bundle identifier
|
// The application's bundle identifier
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = tech.lolli.toolbox
|
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox
|
||||||
|
|
||||||
// The copyright displayed in application information
|
// The copyright displayed in application information
|
||||||
PRODUCT_COPYRIGHT = Copyright © 2021 tech.lolli. All rights reserved.
|
PRODUCT_COPYRIGHT = Copyright © 2022 tech.lolli. All rights reserved.
|
||||||
|
|||||||
@@ -8,5 +8,7 @@
|
|||||||
<true/>
|
<true/>
|
||||||
<key>com.apple.security.network.server</key>
|
<key>com.apple.security.network.server</key>
|
||||||
<true/>
|
<true/>
|
||||||
|
<key>com.apple.security.network.client</key>
|
||||||
|
<true/>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|||||||
@@ -17,9 +17,11 @@
|
|||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>APPL</string>
|
<string>APPL</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>$(FLUTTER_BUILD_NAME)</string>
|
<string>$(MARKETING_VERSION)</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>$(FLUTTER_BUILD_NUMBER)</string>
|
<string>$(CURRENT_PROJECT_VERSION)</string>
|
||||||
|
<key>LSApplicationCategoryType</key>
|
||||||
|
<string>public.app-category.developer-tools</string>
|
||||||
<key>LSMinimumSystemVersion</key>
|
<key>LSMinimumSystemVersion</key>
|
||||||
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
|
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
|
||||||
<key>NSHumanReadableCopyright</key>
|
<key>NSHumanReadableCopyright</key>
|
||||||
|
|||||||
@@ -4,7 +4,8 @@ import FlutterMacOS
|
|||||||
class MainFlutterWindow: NSWindow {
|
class MainFlutterWindow: NSWindow {
|
||||||
override func awakeFromNib() {
|
override func awakeFromNib() {
|
||||||
let flutterViewController = FlutterViewController.init()
|
let flutterViewController = FlutterViewController.init()
|
||||||
let windowFrame = self.frame
|
var windowFrame = self.frame
|
||||||
|
windowFrame.size = CGSize(width: 450, height: 800)
|
||||||
self.contentViewController = flutterViewController
|
self.contentViewController = flutterViewController
|
||||||
self.setFrame(windowFrame, display: true)
|
self.setFrame(windowFrame, display: true)
|
||||||
|
|
||||||
|
|||||||
@@ -4,5 +4,7 @@
|
|||||||
<dict>
|
<dict>
|
||||||
<key>com.apple.security.app-sandbox</key>
|
<key>com.apple.security.app-sandbox</key>
|
||||||
<true/>
|
<true/>
|
||||||
|
<key>com.apple.security.network.client</key>
|
||||||
|
<true/>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|||||||
12
make.dart
@@ -4,7 +4,7 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
const appName = 'ToolBox';
|
const appName = 'ServerBox';
|
||||||
|
|
||||||
Future<int> getGitCommitCount() async {
|
Future<int> getGitCommitCount() async {
|
||||||
final result = await Process.run('git', ['log', '--oneline']);
|
final result = await Process.run('git', ['log', '--oneline']);
|
||||||
@@ -67,6 +67,15 @@ Future<void> updateBuildData() async {
|
|||||||
await writeStaicConfigFile(data, 'BuildData', path);
|
await writeStaicConfigFile(data, 'BuildData', path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void dartFormat() {
|
||||||
|
final result = Process.runSync('dart', ['format', '.']);
|
||||||
|
print(result.stdout);
|
||||||
|
if (result.exitCode != 0) {
|
||||||
|
print(result.stderr);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void flutterRun(String? mode) {
|
void flutterRun(String? mode) {
|
||||||
Process.start('flutter', ['run', mode == null ? '' : '--$mode'],
|
Process.start('flutter', ['run', mode == null ? '' : '--$mode'],
|
||||||
mode: ProcessStartMode.inheritStdio, runInShell: true);
|
mode: ProcessStartMode.inheritStdio, runInShell: true);
|
||||||
@@ -126,6 +135,7 @@ void main(List<String> args) async {
|
|||||||
case 'build':
|
case 'build':
|
||||||
if (args.length > 1) {
|
if (args.length > 1) {
|
||||||
await updateBuildData();
|
await updateBuildData();
|
||||||
|
dartFormat();
|
||||||
if (args[1] == 'android' || args[1] == 'harmony') {
|
if (args[1] == 'android' || args[1] == 'harmony') {
|
||||||
return flutterBuildAndroid();
|
return flutterBuildAndroid();
|
||||||
} else if (args[1] == 'ios') {
|
} else if (args[1] == 'ios') {
|
||||||
|
|||||||
219
pubspec.lock
@@ -14,7 +14,7 @@ packages:
|
|||||||
name: archive
|
name: archive
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.1.6"
|
version: "3.1.11"
|
||||||
args:
|
args:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -22,13 +22,20 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.3.0"
|
version: "2.3.0"
|
||||||
|
asn1lib:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: asn1lib
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "1.1.0"
|
||||||
async:
|
async:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: async
|
name: async
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.8.1"
|
version: "2.8.2"
|
||||||
boolean_selector:
|
boolean_selector:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -42,7 +49,7 @@ packages:
|
|||||||
name: characters
|
name: characters
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.1.0"
|
version: "1.2.0"
|
||||||
charcode:
|
charcode:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -55,7 +62,7 @@ packages:
|
|||||||
description:
|
description:
|
||||||
path: "."
|
path: "."
|
||||||
ref: main
|
ref: main
|
||||||
resolved-ref: "36a46aaa41690aac96fa808a6e75841464007a3b"
|
resolved-ref: "01eb9bcc7f1a1690381caeedb476ea98c5295d55"
|
||||||
url: "https://github.com/LollipopKit/circle_chart"
|
url: "https://github.com/LollipopKit/circle_chart"
|
||||||
source: git
|
source: git
|
||||||
version: "0.0.3"
|
version: "0.0.3"
|
||||||
@@ -80,6 +87,13 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.15.0"
|
version: "1.15.0"
|
||||||
|
convert:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: convert
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "3.0.1"
|
||||||
countly_flutter:
|
countly_flutter:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@@ -96,13 +110,48 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.0.1"
|
version: "3.0.1"
|
||||||
|
dart_console:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: dart_console
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.0"
|
||||||
|
dart_ping:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: dart_ping
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "6.1.1"
|
||||||
|
dart_ping_ios:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: dart_ping_ios
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.0"
|
||||||
|
dartssh2:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: dartssh2
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "2.4.4"
|
||||||
dio:
|
dio:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: dio
|
name: dio
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.0.1"
|
version: "4.0.4"
|
||||||
|
dropdown_button2:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: dropdown_button2
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "1.1.1"
|
||||||
extended_image:
|
extended_image:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@@ -116,7 +165,14 @@ packages:
|
|||||||
name: extended_image_library
|
name: extended_image_library
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.1.0"
|
version: "3.1.2"
|
||||||
|
fading_edge_scrollview:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: fading_edge_scrollview
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "2.0.1"
|
||||||
fake_async:
|
fake_async:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -143,6 +199,20 @@ packages:
|
|||||||
description: flutter
|
description: flutter
|
||||||
source: sdk
|
source: sdk
|
||||||
version: "0.0.0"
|
version: "0.0.0"
|
||||||
|
flutter_advanced_drawer:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: flutter_advanced_drawer
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "1.3.0"
|
||||||
|
flutter_icmp_ping:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: flutter_icmp_ping
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "3.0.2"
|
||||||
flutter_lints:
|
flutter_lints:
|
||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
description:
|
description:
|
||||||
@@ -163,21 +233,14 @@ packages:
|
|||||||
name: flutter_native_splash
|
name: flutter_native_splash
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.3.1"
|
version: "1.3.3"
|
||||||
flutter_plugin_android_lifecycle:
|
flutter_plugin_android_lifecycle:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: flutter_plugin_android_lifecycle
|
name: flutter_plugin_android_lifecycle
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.4"
|
version: "2.0.5"
|
||||||
flutter_staggered_animations:
|
|
||||||
dependency: "direct main"
|
|
||||||
description:
|
|
||||||
name: flutter_staggered_animations
|
|
||||||
url: "https://pub.dartlang.org"
|
|
||||||
source: hosted
|
|
||||||
version: "1.0.0"
|
|
||||||
flutter_test:
|
flutter_test:
|
||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
description: flutter
|
description: flutter
|
||||||
@@ -201,7 +264,7 @@ packages:
|
|||||||
name: hive
|
name: hive
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.4"
|
version: "2.0.5"
|
||||||
hive_flutter:
|
hive_flutter:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@@ -236,7 +299,7 @@ packages:
|
|||||||
name: image
|
name: image
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.0.8"
|
version: "3.1.1"
|
||||||
js:
|
js:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -258,13 +321,27 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.2"
|
version: "1.0.2"
|
||||||
|
marquee:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: marquee
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "2.2.0"
|
||||||
matcher:
|
matcher:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: matcher
|
name: matcher
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.12.10"
|
version: "0.12.11"
|
||||||
|
material_color_utilities:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: material_color_utilities
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "0.1.3"
|
||||||
meta:
|
meta:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -292,35 +369,49 @@ packages:
|
|||||||
name: path_provider
|
name: path_provider
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.6"
|
version: "2.0.8"
|
||||||
|
path_provider_android:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: path_provider_android
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "2.0.11"
|
||||||
|
path_provider_ios:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: path_provider_ios
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "2.0.7"
|
||||||
path_provider_linux:
|
path_provider_linux:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: path_provider_linux
|
name: path_provider_linux
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.0"
|
version: "2.1.5"
|
||||||
path_provider_macos:
|
path_provider_macos:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: path_provider_macos
|
name: path_provider_macos
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.2"
|
version: "2.0.5"
|
||||||
path_provider_platform_interface:
|
path_provider_platform_interface:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: path_provider_platform_interface
|
name: path_provider_platform_interface
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.1"
|
version: "2.0.3"
|
||||||
path_provider_windows:
|
path_provider_windows:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: path_provider_windows
|
name: path_provider_windows
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.3"
|
version: "2.0.5"
|
||||||
pedantic:
|
pedantic:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -335,20 +426,34 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.4.0"
|
version: "4.4.0"
|
||||||
|
pinenacl:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: pinenacl
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "0.3.3"
|
||||||
platform:
|
platform:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: platform
|
name: platform
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.0.2"
|
version: "3.1.0"
|
||||||
plugin_platform_interface:
|
plugin_platform_interface:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: plugin_platform_interface
|
name: plugin_platform_interface
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.2"
|
version: "2.1.2"
|
||||||
|
pointycastle:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: pointycastle
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "3.5.0"
|
||||||
process:
|
process:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -362,7 +467,21 @@ packages:
|
|||||||
name: provider
|
name: provider
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "6.0.1"
|
version: "6.0.2"
|
||||||
|
pull_to_refresh:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: pull_to_refresh
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "2.0.0"
|
||||||
|
r_upgrade:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: r_upgrade
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "0.3.7+2"
|
||||||
sky_engine:
|
sky_engine:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description: flutter
|
description: flutter
|
||||||
@@ -375,13 +494,6 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.8.1"
|
version: "1.8.1"
|
||||||
ssh2:
|
|
||||||
dependency: "direct main"
|
|
||||||
description:
|
|
||||||
name: ssh2
|
|
||||||
url: "https://pub.dartlang.org"
|
|
||||||
source: hosted
|
|
||||||
version: "2.2.3"
|
|
||||||
stack_trace:
|
stack_trace:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -416,7 +528,7 @@ packages:
|
|||||||
name: test_api
|
name: test_api
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.4.2"
|
version: "0.4.8"
|
||||||
typed_data:
|
typed_data:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -437,35 +549,49 @@ packages:
|
|||||||
name: url_launcher
|
name: url_launcher
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "6.0.12"
|
version: "6.0.18"
|
||||||
|
url_launcher_android:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: url_launcher_android
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "6.0.14"
|
||||||
|
url_launcher_ios:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: url_launcher_ios
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "6.0.14"
|
||||||
url_launcher_linux:
|
url_launcher_linux:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: url_launcher_linux
|
name: url_launcher_linux
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.2"
|
version: "2.0.3"
|
||||||
url_launcher_macos:
|
url_launcher_macos:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: url_launcher_macos
|
name: url_launcher_macos
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.2"
|
version: "2.0.3"
|
||||||
url_launcher_platform_interface:
|
url_launcher_platform_interface:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: url_launcher_platform_interface
|
name: url_launcher_platform_interface
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.4"
|
version: "2.0.5"
|
||||||
url_launcher_web:
|
url_launcher_web:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: url_launcher_web
|
name: url_launcher_web
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.4"
|
version: "2.0.6"
|
||||||
url_launcher_windows:
|
url_launcher_windows:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -473,34 +599,27 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.2"
|
version: "2.0.2"
|
||||||
uuid:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: uuid
|
|
||||||
url: "https://pub.dartlang.org"
|
|
||||||
source: hosted
|
|
||||||
version: "3.0.5"
|
|
||||||
vector_math:
|
vector_math:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: vector_math
|
name: vector_math
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.0"
|
version: "2.1.1"
|
||||||
win32:
|
win32:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: win32
|
name: win32
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.2.10"
|
version: "2.3.11"
|
||||||
xdg_directories:
|
xdg_directories:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: xdg_directories
|
name: xdg_directories
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.2.0"
|
version: "0.2.0+1"
|
||||||
xml:
|
xml:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -516,5 +635,5 @@ packages:
|
|||||||
source: hosted
|
source: hosted
|
||||||
version: "3.1.0"
|
version: "3.1.0"
|
||||||
sdks:
|
sdks:
|
||||||
dart: ">=2.14.0 <3.0.0"
|
dart: ">=2.15.1 <3.0.0"
|
||||||
flutter: ">=2.5.0"
|
flutter: ">=2.5.0"
|
||||||
|
|||||||
11
pubspec.yaml
@@ -36,21 +36,28 @@ dependencies:
|
|||||||
hive_flutter: ^1.0.0
|
hive_flutter: ^1.0.0
|
||||||
dio: ^4.0.0
|
dio: ^4.0.0
|
||||||
after_layout: ^1.1.0
|
after_layout: ^1.1.0
|
||||||
flutter_staggered_animations: ^1.0.0
|
|
||||||
extended_image: ^5.1.3
|
extended_image: ^5.1.3
|
||||||
url_launcher: ^6.0.9
|
url_launcher: ^6.0.9
|
||||||
countly_flutter:
|
countly_flutter:
|
||||||
git:
|
git:
|
||||||
url: https://github.com/Countly/countly-sdk-flutter-bridge.git
|
url: https://github.com/Countly/countly-sdk-flutter-bridge.git
|
||||||
ref: master
|
ref: master
|
||||||
ssh2: ^2.2.3
|
dartssh2: ^2.3.1-pre
|
||||||
logging: ^1.0.2
|
logging: ^1.0.2
|
||||||
flutter_material_color_picker: ^1.1.0+2
|
flutter_material_color_picker: ^1.1.0+2
|
||||||
circle_chart:
|
circle_chart:
|
||||||
git:
|
git:
|
||||||
url: https://github.com/LollipopKit/circle_chart
|
url: https://github.com/LollipopKit/circle_chart
|
||||||
ref: main
|
ref: main
|
||||||
|
# path: ../circle_chart
|
||||||
clipboard: ^0.1.3
|
clipboard: ^0.1.3
|
||||||
|
r_upgrade: ^0.3.6
|
||||||
|
pull_to_refresh: ^2.0.0
|
||||||
|
marquee: ^2.2.0
|
||||||
|
dart_ping: ^6.1.1
|
||||||
|
dart_ping_ios: ^1.0.0
|
||||||
|
dropdown_button2: ^1.1.1
|
||||||
|
flutter_advanced_drawer: ^1.3.0
|
||||||
|
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 280 KiB |
|
Before Width: | Height: | Size: 218 KiB |
|
Before Width: | Height: | Size: 238 KiB |
|
Before Width: | Height: | Size: 339 KiB |
|
Before Width: | Height: | Size: 383 KiB |
|
Before Width: | Height: | Size: 184 KiB |
BIN
screenshots/convert.jpg
Normal file
|
After Width: | Height: | Size: 178 KiB |
|
Before Width: | Height: | Size: 200 KiB |
BIN
screenshots/drawer.jpg
Normal file
|
After Width: | Height: | Size: 180 KiB |
BIN
screenshots/ping.jpg
Normal file
|
After Width: | Height: | Size: 316 KiB |
BIN
screenshots/server.jpg
Normal file
|
After Width: | Height: | Size: 332 KiB |
BIN
screenshots/server_detail.jpg
Normal file
|
After Width: | Height: | Size: 273 KiB |
BIN
screenshots/server_edit.jpg
Normal file
|
After Width: | Height: | Size: 175 KiB |
BIN
screenshots/setting.jpg
Normal file
|
After Width: | Height: | Size: 367 KiB |
@@ -26,7 +26,7 @@
|
|||||||
<meta name="apple-mobile-web-app-title" content="toolbox">
|
<meta name="apple-mobile-web-app-title" content="toolbox">
|
||||||
<link rel="apple-touch-icon" href="icons/Icon-192.png">
|
<link rel="apple-touch-icon" href="icons/Icon-192.png">
|
||||||
|
|
||||||
<title>toolbox</title>
|
<title>ServerBox</title>
|
||||||
<link rel="manifest" href="manifest.json">
|
<link rel="manifest" href="manifest.json">
|
||||||
<link rel="stylesheet" type="text/css" href="splash/style.css">
|
<link rel="stylesheet" type="text/css" href="splash/style.css">
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
17
windows/.gitignore
vendored
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
flutter/ephemeral/
|
||||||
|
|
||||||
|
# Visual Studio user-specific files.
|
||||||
|
*.suo
|
||||||
|
*.user
|
||||||
|
*.userosscache
|
||||||
|
*.sln.docstates
|
||||||
|
|
||||||
|
# Visual Studio build-related files.
|
||||||
|
x64/
|
||||||
|
x86/
|
||||||
|
|
||||||
|
# Visual Studio cache files
|
||||||
|
# files ending in .cache can be ignored
|
||||||
|
*.[Cc]ache
|
||||||
|
# but keep track of directories ending in .cache
|
||||||
|
!*.[Cc]ache/
|
||||||
95
windows/CMakeLists.txt
Normal file
@@ -0,0 +1,95 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.14)
|
||||||
|
project(toolbox LANGUAGES CXX)
|
||||||
|
|
||||||
|
set(BINARY_NAME "ServerBox")
|
||||||
|
|
||||||
|
cmake_policy(SET CMP0063 NEW)
|
||||||
|
|
||||||
|
set(CMAKE_INSTALL_RPATH "$ORIGIN/lib")
|
||||||
|
|
||||||
|
# Configure build options.
|
||||||
|
get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
||||||
|
if(IS_MULTICONFIG)
|
||||||
|
set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release"
|
||||||
|
CACHE STRING "" FORCE)
|
||||||
|
else()
|
||||||
|
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||||
|
set(CMAKE_BUILD_TYPE "Debug" CACHE
|
||||||
|
STRING "Flutter build mode" FORCE)
|
||||||
|
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
|
||||||
|
"Debug" "Profile" "Release")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}")
|
||||||
|
set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}")
|
||||||
|
set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}")
|
||||||
|
set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}")
|
||||||
|
|
||||||
|
# Use Unicode for all projects.
|
||||||
|
add_definitions(-DUNICODE -D_UNICODE)
|
||||||
|
|
||||||
|
# Compilation settings that should be applied to most targets.
|
||||||
|
function(APPLY_STANDARD_SETTINGS TARGET)
|
||||||
|
target_compile_features(${TARGET} PUBLIC cxx_std_17)
|
||||||
|
target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100")
|
||||||
|
target_compile_options(${TARGET} PRIVATE /EHsc)
|
||||||
|
target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0")
|
||||||
|
target_compile_definitions(${TARGET} PRIVATE "$<$<CONFIG:Debug>:_DEBUG>")
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter")
|
||||||
|
|
||||||
|
# Flutter library and tool build rules.
|
||||||
|
add_subdirectory(${FLUTTER_MANAGED_DIR})
|
||||||
|
|
||||||
|
# Application build
|
||||||
|
add_subdirectory("runner")
|
||||||
|
|
||||||
|
# Generated plugin build rules, which manage building the plugins and adding
|
||||||
|
# them to the application.
|
||||||
|
include(flutter/generated_plugins.cmake)
|
||||||
|
|
||||||
|
|
||||||
|
# === Installation ===
|
||||||
|
# Support files are copied into place next to the executable, so that it can
|
||||||
|
# run in place. This is done instead of making a separate bundle (as on Linux)
|
||||||
|
# so that building and running from within Visual Studio will work.
|
||||||
|
set(BUILD_BUNDLE_DIR "$<TARGET_FILE_DIR:${BINARY_NAME}>")
|
||||||
|
# Make the "install" step default, as it's required to run.
|
||||||
|
set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1)
|
||||||
|
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
||||||
|
set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data")
|
||||||
|
set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}")
|
||||||
|
|
||||||
|
install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}"
|
||||||
|
COMPONENT Runtime)
|
||||||
|
|
||||||
|
install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
|
||||||
|
COMPONENT Runtime)
|
||||||
|
|
||||||
|
install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
|
||||||
|
COMPONENT Runtime)
|
||||||
|
|
||||||
|
if(PLUGIN_BUNDLED_LIBRARIES)
|
||||||
|
install(FILES "${PLUGIN_BUNDLED_LIBRARIES}"
|
||||||
|
DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
|
||||||
|
COMPONENT Runtime)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Fully re-copy the assets directory on each build to avoid having stale files
|
||||||
|
# from a previous install.
|
||||||
|
set(FLUTTER_ASSET_DIR_NAME "flutter_assets")
|
||||||
|
install(CODE "
|
||||||
|
file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\")
|
||||||
|
" COMPONENT Runtime)
|
||||||
|
install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}"
|
||||||
|
DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime)
|
||||||
|
|
||||||
|
# Install the AOT library on non-Debug builds only.
|
||||||
|
install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
|
||||||
|
CONFIGURATIONS Profile;Release
|
||||||
|
COMPONENT Runtime)
|
||||||
103
windows/flutter/CMakeLists.txt
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.14)
|
||||||
|
|
||||||
|
set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral")
|
||||||
|
|
||||||
|
# Configuration provided via flutter tool.
|
||||||
|
include(${EPHEMERAL_DIR}/generated_config.cmake)
|
||||||
|
|
||||||
|
# TODO: Move the rest of this into files in ephemeral. See
|
||||||
|
# https://github.com/flutter/flutter/issues/57146.
|
||||||
|
set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper")
|
||||||
|
|
||||||
|
# === Flutter Library ===
|
||||||
|
set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll")
|
||||||
|
|
||||||
|
# Published to parent scope for install step.
|
||||||
|
set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE)
|
||||||
|
set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE)
|
||||||
|
set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE)
|
||||||
|
set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE)
|
||||||
|
|
||||||
|
list(APPEND FLUTTER_LIBRARY_HEADERS
|
||||||
|
"flutter_export.h"
|
||||||
|
"flutter_windows.h"
|
||||||
|
"flutter_messenger.h"
|
||||||
|
"flutter_plugin_registrar.h"
|
||||||
|
"flutter_texture_registrar.h"
|
||||||
|
)
|
||||||
|
list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/")
|
||||||
|
add_library(flutter INTERFACE)
|
||||||
|
target_include_directories(flutter INTERFACE
|
||||||
|
"${EPHEMERAL_DIR}"
|
||||||
|
)
|
||||||
|
target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib")
|
||||||
|
add_dependencies(flutter flutter_assemble)
|
||||||
|
|
||||||
|
# === Wrapper ===
|
||||||
|
list(APPEND CPP_WRAPPER_SOURCES_CORE
|
||||||
|
"core_implementations.cc"
|
||||||
|
"standard_codec.cc"
|
||||||
|
)
|
||||||
|
list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/")
|
||||||
|
list(APPEND CPP_WRAPPER_SOURCES_PLUGIN
|
||||||
|
"plugin_registrar.cc"
|
||||||
|
)
|
||||||
|
list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/")
|
||||||
|
list(APPEND CPP_WRAPPER_SOURCES_APP
|
||||||
|
"flutter_engine.cc"
|
||||||
|
"flutter_view_controller.cc"
|
||||||
|
)
|
||||||
|
list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/")
|
||||||
|
|
||||||
|
# Wrapper sources needed for a plugin.
|
||||||
|
add_library(flutter_wrapper_plugin STATIC
|
||||||
|
${CPP_WRAPPER_SOURCES_CORE}
|
||||||
|
${CPP_WRAPPER_SOURCES_PLUGIN}
|
||||||
|
)
|
||||||
|
apply_standard_settings(flutter_wrapper_plugin)
|
||||||
|
set_target_properties(flutter_wrapper_plugin PROPERTIES
|
||||||
|
POSITION_INDEPENDENT_CODE ON)
|
||||||
|
set_target_properties(flutter_wrapper_plugin PROPERTIES
|
||||||
|
CXX_VISIBILITY_PRESET hidden)
|
||||||
|
target_link_libraries(flutter_wrapper_plugin PUBLIC flutter)
|
||||||
|
target_include_directories(flutter_wrapper_plugin PUBLIC
|
||||||
|
"${WRAPPER_ROOT}/include"
|
||||||
|
)
|
||||||
|
add_dependencies(flutter_wrapper_plugin flutter_assemble)
|
||||||
|
|
||||||
|
# Wrapper sources needed for the runner.
|
||||||
|
add_library(flutter_wrapper_app STATIC
|
||||||
|
${CPP_WRAPPER_SOURCES_CORE}
|
||||||
|
${CPP_WRAPPER_SOURCES_APP}
|
||||||
|
)
|
||||||
|
apply_standard_settings(flutter_wrapper_app)
|
||||||
|
target_link_libraries(flutter_wrapper_app PUBLIC flutter)
|
||||||
|
target_include_directories(flutter_wrapper_app PUBLIC
|
||||||
|
"${WRAPPER_ROOT}/include"
|
||||||
|
)
|
||||||
|
add_dependencies(flutter_wrapper_app flutter_assemble)
|
||||||
|
|
||||||
|
# === Flutter tool backend ===
|
||||||
|
# _phony_ is a non-existent file to force this command to run every time,
|
||||||
|
# since currently there's no way to get a full input/output list from the
|
||||||
|
# flutter tool.
|
||||||
|
set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_")
|
||||||
|
set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE)
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS}
|
||||||
|
${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN}
|
||||||
|
${CPP_WRAPPER_SOURCES_APP}
|
||||||
|
${PHONY_OUTPUT}
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E env
|
||||||
|
${FLUTTER_TOOL_ENVIRONMENT}
|
||||||
|
"${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat"
|
||||||
|
windows-x64 $<CONFIG>
|
||||||
|
VERBATIM
|
||||||
|
)
|
||||||
|
add_custom_target(flutter_assemble DEPENDS
|
||||||
|
"${FLUTTER_LIBRARY}"
|
||||||
|
${FLUTTER_LIBRARY_HEADERS}
|
||||||
|
${CPP_WRAPPER_SOURCES_CORE}
|
||||||
|
${CPP_WRAPPER_SOURCES_PLUGIN}
|
||||||
|
${CPP_WRAPPER_SOURCES_APP}
|
||||||
|
)
|
||||||
14
windows/flutter/generated_plugin_registrant.cc
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
//
|
||||||
|
// Generated file. Do not edit.
|
||||||
|
//
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
|
|
||||||
|
#include "generated_plugin_registrant.h"
|
||||||
|
|
||||||
|
#include <url_launcher_windows/url_launcher_windows.h>
|
||||||
|
|
||||||
|
void RegisterPlugins(flutter::PluginRegistry* registry) {
|
||||||
|
UrlLauncherWindowsRegisterWithRegistrar(
|
||||||
|
registry->GetRegistrarForPlugin("UrlLauncherWindows"));
|
||||||
|
}
|
||||||
15
windows/flutter/generated_plugin_registrant.h
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
//
|
||||||
|
// Generated file. Do not edit.
|
||||||
|
//
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
|
|
||||||
|
#ifndef GENERATED_PLUGIN_REGISTRANT_
|
||||||
|
#define GENERATED_PLUGIN_REGISTRANT_
|
||||||
|
|
||||||
|
#include <flutter/plugin_registry.h>
|
||||||
|
|
||||||
|
// Registers Flutter plugins.
|
||||||
|
void RegisterPlugins(flutter::PluginRegistry* registry);
|
||||||
|
|
||||||
|
#endif // GENERATED_PLUGIN_REGISTRANT_
|
||||||