Solve launches too slow

This commit is contained in:
Junyuan Feng
2022-01-09 19:21:42 +08:00
parent 317936c521
commit 7e36c06542
4 changed files with 12 additions and 12 deletions

View File

@@ -73,8 +73,7 @@ class ServerProvider extends BusyProvider {
final auth = spi.authorization as Map<String, dynamic>; final auth = spi.authorization as Map<String, dynamic>;
return SSHClient(socket, return SSHClient(socket,
username: spi.user, username: spi.user,
identities: SSHKeyPair.fromPem(auth['privateKey'], identities: SSHKeyPair.fromPem(auth['privateKey'], auth['passphrase']));
auth['passphrase']));
} }
Future<void> refreshData({int? idx}) async { Future<void> refreshData({int? idx}) async {
@@ -105,6 +104,7 @@ class ServerProvider extends BusyProvider {
locator<SettingStore>().serverStatusUpdateInterval.fetch()!; locator<SettingStore>().serverStatusUpdateInterval.fetch()!;
if (duration == 0) return; if (duration == 0) return;
stopAutoRefresh(); stopAutoRefresh();
Future.delayed(const Duration(milliseconds: 677), () => refreshData());
_timer = Timer.periodic(Duration(seconds: duration), (_) async { _timer = Timer.periodic(Duration(seconds: duration), (_) async {
await refreshData(); await refreshData();
}); });

View File

@@ -2,8 +2,8 @@
class BuildData { class BuildData {
static const String name = "ToolBox"; static const String name = "ToolBox";
static const int build = 70; static const int build = 73;
static const String engine = "Flutter 2.8.1 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision 77d935af4d (3 weeks ago) • 2021-12-16 08:37:33 -0800\nEngine • revision 890a5fca2e\nTools • Dart 2.15.1\n"; static const String engine = "Flutter 2.8.1 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision 77d935af4d (3 weeks ago) • 2021-12-16 08:37:33 -0800\nEngine • revision 890a5fca2e\nTools • Dart 2.15.1\n";
static const String buildAt = "2022-01-03 14:58:50.087508"; static const String buildAt = "2022-01-09 19:17:25.988021";
static const int modifications = 2; static const int modifications = 4;
} }

View File

@@ -118,8 +118,8 @@ class _ServerPageState extends State<ServerPage>
child: child:
_buildRealServerCard(si.status, si.info.name, si.connectionState), _buildRealServerCard(si.status, si.info.name, si.connectionState),
), ),
onTap: () => onTap: () => AppRoute(ServerDetailPage('${si.info.ip}:${si.info.port}'),
AppRoute(ServerDetailPage('${si.info.ip}:${si.info.port}'), 'server detail page') 'server detail page')
.go(context), .go(context),
), ),
); );
@@ -132,7 +132,8 @@ class _ServerPageState extends State<ServerPage>
final topRightStr = final topRightStr =
getTopRightStr(cs, ss.cpu2Status.temp, ss.uptime, ss.failedInfo); getTopRightStr(cs, ss.cpu2Status.temp, ss.uptime, ss.failedInfo);
final hasError = cs == ServerConnectionState.failed && ss.failedInfo != null; final hasError =
cs == ServerConnectionState.failed && ss.failedInfo != null;
final style = TextStyle( final style = TextStyle(
color: _theme.textTheme.bodyText1!.color!.withAlpha(100), fontSize: 11); color: _theme.textTheme.bodyText1!.color!.withAlpha(100), fontSize: 11);
@@ -283,7 +284,6 @@ class _ServerPageState extends State<ServerPage>
Future<void> afterFirstLayout(BuildContext context) async { Future<void> afterFirstLayout(BuildContext context) async {
await GetIt.I.allReady(); await GetIt.I.allReady();
await _serverProvider.loadLocalData(); await _serverProvider.loadLocalData();
await _serverProvider.refreshData(); _serverProvider.startAutoRefresh();
await _serverProvider.startAutoRefresh();
} }
} }

View File

@@ -5,7 +5,7 @@ class MainFlutterWindow: NSWindow {
override func awakeFromNib() { override func awakeFromNib() {
let flutterViewController = FlutterViewController.init() let flutterViewController = FlutterViewController.init()
var windowFrame = self.frame var windowFrame = self.frame
windowFrame.size = CGSize(width: 270, height: 480) windowFrame.size = CGSize(width: 1080, height: 1920)
self.contentViewController = flutterViewController self.contentViewController = flutterViewController
self.setFrame(windowFrame, display: true) self.setFrame(windowFrame, display: true)