diff --git a/lib/data/model/server/tcp_status.dart b/lib/data/model/server/tcp_status.dart index 835aba8f..daf0d3e7 100644 --- a/lib/data/model/server/tcp_status.dart +++ b/lib/data/model/server/tcp_status.dart @@ -29,7 +29,7 @@ class TcpStatus { passive = json["passive"].toInt(); fail = json["fail"].toInt(); } - + Map toJson() { final Map data = {}; data["maxConn"] = maxConn; diff --git a/lib/data/provider/server.dart b/lib/data/provider/server.dart index f7eeda8e..7b3971b4 100644 --- a/lib/data/provider/server.dart +++ b/lib/data/provider/server.dart @@ -114,7 +114,9 @@ class ServerProvider extends BusyProvider { final client = _servers[idx].client; final connected = await client.isConnected(); final state = _servers[idx].connectionState; - if (!connected || state == ServerConnectionState.failed || state == ServerConnectionState.disconnected) { + if (!connected || + state == ServerConnectionState.failed || + state == ServerConnectionState.disconnected) { _servers[idx].connectionState = ServerConnectionState.connecting; notifyListeners(); final time1 = DateTime.now(); diff --git a/lib/data/res/build_data.dart b/lib/data/res/build_data.dart index 899f4122..344d75dc 100644 --- a/lib/data/res/build_data.dart +++ b/lib/data/res/build_data.dart @@ -2,8 +2,9 @@ class BuildData { static const String name = "ToolBox"; - static const int build = 44; - static const String engine = "Flutter 2.5.3 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision 18116933e7 (2 weeks ago) • 2021-10-15 10:46:35 -0700\nEngine • revision d3ea636dc5\nTools • Dart 2.14.4\n"; - static const String buildAt = "2021-10-29 13:31:42.064782"; + static const int build = 50; + static const String engine = + "Flutter 2.5.3 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision 18116933e7 (2 weeks ago) • 2021-10-15 10:46:35 -0700\nEngine • revision d3ea636dc5\nTools • Dart 2.14.4\n"; + static const String buildAt = "2021-10-31 22:21:56.798068"; static const int modifications = 1; } diff --git a/lib/data/res/color.dart b/lib/data/res/color.dart index e361ba69..8fa6bc17 100644 --- a/lib/data/res/color.dart +++ b/lib/data/res/color.dart @@ -18,3 +18,4 @@ class DynamicColor { } final mainColor = DynamicColor(Colors.black87, Colors.white70); +final progressColor = DynamicColor(Colors.grey.shade100, Colors.grey); diff --git a/lib/data/res/icon/linux_icons.dart b/lib/data/res/icon/linux_icons.dart index ee50149b..bf98b378 100644 --- a/lib/data/res/icon/linux_icons.dart +++ b/lib/data/res/icon/linux_icons.dart @@ -1,4 +1,4 @@ import 'package:toolbox/data/model/server/linux_icon.dart'; -final linuxIcons = LinuxIcons(['ubuntu', 'arch', 'centos', 'debian', 'fedora', -'opensuse', 'kali']); \ No newline at end of file +final linuxIcons = LinuxIcons( + ['ubuntu', 'arch', 'centos', 'debian', 'fedora', 'opensuse', 'kali']); diff --git a/lib/data/store/snippet.dart b/lib/data/store/snippet.dart index e580bb32..88cb1c4f 100644 --- a/lib/data/store/snippet.dart +++ b/lib/data/store/snippet.dart @@ -11,8 +11,7 @@ class SnippetStore extends PersistentStore { } List fetch() { - return getSnippetList( - json.decode(box.get('snippet', defaultValue: '[]')!)); + return getSnippetList(json.decode(box.get('snippet', defaultValue: '[]')!)); } void delete(Snippet s) { @@ -30,4 +29,4 @@ class SnippetStore extends PersistentStore { int index(Snippet s) => fetch().indexWhere((e) => e.name == s.name); bool have(Snippet s) => index(s) != -1; -} \ No newline at end of file +} diff --git a/lib/view/page/home.dart b/lib/view/page/home.dart index 875e3676..40ff4c51 100644 --- a/lib/view/page/home.dart +++ b/lib/view/page/home.dart @@ -84,7 +84,8 @@ class _MyHomePageState extends State leading: const Icon(Icons.vpn_key), title: const Text('Private Key'), onTap: () => - AppRoute(const StoredPrivateKeysPage(), 'private key list').go(context), + AppRoute(const StoredPrivateKeysPage(), 'private key list') + .go(context), ), AboutListTile( icon: const Icon(Icons.text_snippet), @@ -94,8 +95,7 @@ class _MyHomePageState extends State applicationIcon: _buildIcon(), aboutBoxChildren: const [ UrlText( - text: '\nMade with ❤️ by $myGithub', - replace: 'LollipopKit'), + text: '\nMade with ❤️ by $myGithub', replace: 'LollipopKit'), UrlText( text: '\nThanks $rainSunMeGithub for participating in the test.\n\nAll rights reserved.', diff --git a/lib/view/page/server/detail.dart b/lib/view/page/server/detail.dart index 8c8d2da7..cfdb6dcf 100644 --- a/lib/view/page/server/detail.dart +++ b/lib/view/page/server/detail.dart @@ -56,7 +56,8 @@ class _ServerDetailPageState extends State Widget _buildLinuxIcon(String sysVer) { final iconPath = linuxIcons.search(sysVer); if (iconPath == null) return const SizedBox(); - return SizedBox(height: _media.size.height * 0.15, child: Image.asset(iconPath)); + return SizedBox( + height: _media.size.height * 0.15, child: Image.asset(iconPath)); } Widget _buildCPUView(ServerStatus ss) { @@ -144,7 +145,7 @@ class _ServerDetailPageState extends State return LinearProgressIndicator( value: percentWithinOne, minHeight: 7, - backgroundColor: Colors.grey[100], + backgroundColor: progressColor.resolve(context), color: pColor.withOpacity(0.5 + percentWithinOne / 2), ); } @@ -177,7 +178,7 @@ class _ServerDetailPageState extends State children: [ _buildMemExplain('Used', pColor), _buildMemExplain('Cache', pColor.withAlpha(77)), - _buildMemExplain('Avail', Colors.grey.shade100) + _buildMemExplain('Avail', progressColor.resolve(context)) ], ), const SizedBox( @@ -195,8 +196,10 @@ class _ServerDetailPageState extends State width: width * (1 - used), child: LinearProgressIndicator( // length == 2: failed to get mem list, now mem list = [100,0] which is initial value. - value: ss.memList.length == 2 ? 0 : ss.memList[4] / ss.memList[0], - backgroundColor: Colors.grey[100], + value: ss.memList.length == 2 + ? 0 + : ss.memList[4] / ss.memList[0], + backgroundColor: progressColor.resolve(context), color: pColor.withAlpha(77), ), ) @@ -261,5 +264,12 @@ class _ServerDetailPageState extends State )); } - static const ignorePath = ['/run', '/sys', '/dev/shm', '/snap', '/var/lib/docker']; + static const ignorePath = [ + '/run', + '/sys', + '/dev/shm', + '/snap', + '/var/lib/docker', + '/dev/tty' + ]; } diff --git a/lib/view/page/server/tab.dart b/lib/view/page/server/tab.dart index bd685efa..0c69f672 100644 --- a/lib/view/page/server/tab.dart +++ b/lib/view/page/server/tab.dart @@ -105,8 +105,8 @@ class _ServerPageState extends State child: InkWell( child: Padding( padding: const EdgeInsets.all(13), - child: _buildRealServerCard( - si.status, si.info.name, si.connectionState), + child: + _buildRealServerCard(si.status, si.info.name, si.connectionState), ), onTap: () => AppRoute(ServerDetailPage(si.client.id!), 'server detail page') diff --git a/lib/view/page/snippet/edit.dart b/lib/view/page/snippet/edit.dart index 2d07eef5..099d8684 100644 --- a/lib/view/page/snippet/edit.dart +++ b/lib/view/page/snippet/edit.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; class SnappetEditPage extends StatefulWidget { - const SnappetEditPage({ Key? key }) : super(key: key); + const SnappetEditPage({Key? key}) : super(key: key); @override _SnappetEditPageState createState() => _SnappetEditPageState(); @@ -10,8 +10,6 @@ class SnappetEditPage extends StatefulWidget { class _SnappetEditPageState extends State { @override Widget build(BuildContext context) { - return Container( - - ); + return Container(); } -} \ No newline at end of file +} diff --git a/lib/view/page/snippet/list.dart b/lib/view/page/snippet/list.dart index 4211b2db..f0f47299 100644 --- a/lib/view/page/snippet/list.dart +++ b/lib/view/page/snippet/list.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; class SnappetListPage extends StatefulWidget { - const SnappetListPage({ Key? key }) : super(key: key); + const SnappetListPage({Key? key}) : super(key: key); @override _SnappetListPageState createState() => _SnappetListPageState(); @@ -10,8 +10,6 @@ class SnappetListPage extends StatefulWidget { class _SnappetListPageState extends State { @override Widget build(BuildContext context) { - return Container( - - ); + return Container(); } -} \ No newline at end of file +}