mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 15:24:35 +01:00
Isolate SSHKeyPair process to avoid run stuck
This commit is contained in:
@@ -3,6 +3,7 @@ import 'dart:convert';
|
||||
import 'package:clipboard/clipboard.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';
|
||||
|
||||
class ConvertPage extends StatefulWidget {
|
||||
@@ -70,7 +71,11 @@ class _ConvertPageState extends State<ConvertPage>
|
||||
),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
onPressed: () {
|
||||
_textEditingControllerResult.text = doConvert();
|
||||
try {
|
||||
_textEditingControllerResult.text = doConvert();
|
||||
} catch (e) {
|
||||
showSnackBar(context, Text('Error: \n$e'));
|
||||
}
|
||||
},
|
||||
tooltip: 'convert',
|
||||
child: const Icon(Icons.send),
|
||||
@@ -79,7 +84,7 @@ class _ConvertPageState extends State<ConvertPage>
|
||||
}
|
||||
|
||||
String doConvert() {
|
||||
final text = _textEditingController.text;
|
||||
final text = _textEditingController.text.trim();
|
||||
switch (_typeOptionIndex) {
|
||||
case 0:
|
||||
return utf8.decode(base64.decode(text));
|
||||
|
||||
@@ -35,8 +35,8 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Consumer<ServerProvider>(builder: (_, provider, __) {
|
||||
return _buildMainPage(
|
||||
provider.servers.firstWhere((e) => '${e.info.ip}:${e.info.port}' == widget.id));
|
||||
return _buildMainPage(provider.servers
|
||||
.firstWhere((e) => '${e.info.ip}:${e.info.port}' == widget.id));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -44,16 +44,6 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
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(
|
||||
padding: const EdgeInsets.all(17),
|
||||
|
||||
@@ -115,8 +115,10 @@ class _ServerPageState extends State<ServerPage>
|
||||
.go(context),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(13),
|
||||
child:
|
||||
_buildRealServerCard(si.status, si.info.name, si.connectionState),
|
||||
child: SizedBox(
|
||||
height: _media.size.height * 0.147,
|
||||
child: _buildRealServerCard(
|
||||
si.status, si.info.name, si.connectionState)),
|
||||
),
|
||||
onTap: () => AppRoute(ServerDetailPage('${si.info.ip}:${si.info.port}'),
|
||||
'server detail page')
|
||||
@@ -239,7 +241,7 @@ class _ServerPageState extends State<ServerPage>
|
||||
Widget _buildPercentCircle(double percent, String title) {
|
||||
if (percent <= 0) percent = 0.01;
|
||||
if (percent >= 100) percent = 99.9;
|
||||
var size = _media.size.height * 0.147;
|
||||
var size = _media.size.height * 0.15;
|
||||
return SizedBox(
|
||||
width: _media.size.width * 0.2,
|
||||
height: _media.size.height * 0.1,
|
||||
@@ -285,6 +287,7 @@ class _ServerPageState extends State<ServerPage>
|
||||
Future<void> afterFirstLayout(BuildContext context) async {
|
||||
await GetIt.I.allReady();
|
||||
await _serverProvider.loadLocalData();
|
||||
_serverProvider.refreshData();
|
||||
_serverProvider.startAutoRefresh();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user