fix & optimize

- fix downloading page unbond size
- auto dispose isolate
This commit is contained in:
Junyuan Feng
2022-05-07 23:05:31 +08:00
parent d224ad8cf8
commit b0c3cd3834
7 changed files with 27 additions and 14 deletions

View File

@@ -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 = 127; CURRENT_PROJECT_VERSION = 128;
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,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.0.127; MARKETING_VERSION = 1.0.128;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; 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";
@@ -484,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 = 127; CURRENT_PROJECT_VERSION = 128;
DEVELOPMENT_TEAM = BA88US33G6; DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
@@ -492,7 +492,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.0.127; MARKETING_VERSION = 1.0.128;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; 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";
@@ -508,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 = 127; CURRENT_PROJECT_VERSION = 128;
DEVELOPMENT_TEAM = BA88US33G6; DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
@@ -516,7 +516,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.0.127; MARKETING_VERSION = 1.0.128;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; 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";

View File

@@ -33,6 +33,9 @@ class SftpDownloadStatus {
switch (event.runtimeType) { switch (event.runtimeType) {
case SftpWorkerStatus: case SftpWorkerStatus:
status = event; status = event;
if (status == SftpWorkerStatus.finished) {
worker.dispose();
}
break; break;
case double: case double:
progress = event; progress = event;

View File

@@ -24,6 +24,10 @@ class SftpDownloadWorker {
final worker = Worker(); final worker = Worker();
final String? privateKey; final String? privateKey;
void dispose() {
worker.dispose();
}
/// Initiate the worker (new thread) and start listen from messages between /// Initiate the worker (new thread) and start listen from messages between
/// the threads /// the threads
Future<void> init() async { Future<void> init() async {

View File

@@ -2,9 +2,9 @@
class BuildData { class BuildData {
static const String name = "ServerBox"; static const String name = "ServerBox";
static const int build = 127; static const int build = 128;
static const String engine = static const String engine =
"Flutter 2.10.5 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision 5464c5bac7 (3 weeks ago) • 2022-04-18 09:55:37 -0700\nEngine • revision 57d3bac3dd\nTools • Dart 2.16.2 • DevTools 2.9.2\n"; "Flutter 2.10.5 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision 5464c5bac7 (3 weeks ago) • 2022-04-18 09:55:37 -0700\nEngine • revision 57d3bac3dd\nTools • Dart 2.16.2 • DevTools 2.9.2\n";
static const String buildAt = "2022-05-07 22:16:13.513462"; static const String buildAt = "2022-05-07 22:36:43.297250";
static const int modifications = 1; static const int modifications = 1;
} }

View File

@@ -47,7 +47,7 @@ class _SFTPDownloadingPageState extends State<SFTPDownloadingPage> {
); );
} }
return ListView.builder( return ListView.builder(
padding: const EdgeInsets.all(13), padding: const EdgeInsets.all(11),
itemCount: pro.status.length, itemCount: pro.status.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
final status = pro.status[index]; final status = pro.status[index];
@@ -78,7 +78,7 @@ class _SFTPDownloadingPageState extends State<SFTPDownloadingPage> {
switch (status.status) { switch (status.status) {
case SftpWorkerStatus.finished: case SftpWorkerStatus.finished:
return _wrapInCard(status, return _wrapInCard(status,
'${s.downloadFinished}, ${s.spentTime(status.spentTime ?? s.unknown)}', '${s.downloadFinished} ${s.spentTime(status.spentTime ?? s.unknown)}',
trailing: IconButton( trailing: IconButton(
onPressed: () => Share.shareFiles([status.item.localPath], onPressed: () => Share.shareFiles([status.item.localPath],
text: '${status.fileName} from ServerBox'), text: '${status.fileName} from ServerBox'),
@@ -91,9 +91,9 @@ class _SFTPDownloadingPageState extends State<SFTPDownloadingPage> {
trailing: trailing:
CircularProgressIndicator(value: (status.progress ?? 0) / 100)); CircularProgressIndicator(value: (status.progress ?? 0) / 100));
case SftpWorkerStatus.preparing: case SftpWorkerStatus.preparing:
return _wrapInCard(status, s.sftpDlPrepare, trailing: centerLoading); return _wrapInCard(status, s.sftpDlPrepare, trailing: loadingIcon);
case SftpWorkerStatus.sshConnectted: case SftpWorkerStatus.sshConnectted:
return _wrapInCard(status, s.sftpSSHConnected, trailing: centerLoading); return _wrapInCard(status, s.sftpSSHConnected, trailing: loadingIcon);
default: default:
return _wrapInCard(status, s.unknown, return _wrapInCard(status, s.unknown,
trailing: const Icon( trailing: const Icon(

View File

@@ -211,13 +211,17 @@ class _SFTPPageState extends State<SFTPPage> {
key: pubKeyId == null key: pubKeyId == null
? null ? null
: locator<PrivateKeyStore>().get(pubKeyId).privateKey); : locator<PrivateKeyStore>().get(pubKeyId).privateKey);
Navigator.of(context).pop();
showRoundDialog(context, s.goSftpDlPage, const SizedBox(), [ showRoundDialog(context, s.goSftpDlPage, const SizedBox(), [
TextButton( TextButton(
onPressed: () => Navigator.of(context).pop(), onPressed: () => Navigator.of(context).pop(),
child: Text(s.cancel)), child: Text(s.cancel)),
TextButton( TextButton(
onPressed: () => onPressed: () {
AppRoute(const SFTPDownloadingPage(), 'sftp downloading'), Navigator.of(context).pop();
AppRoute(const SFTPDownloadingPage(), 'sftp downloading')
.go(context);
},
child: Text(s.ok)) child: Text(s.ok))
]); ]);
}, },

View File

@@ -9,3 +9,5 @@ const centerSizedLoading = SizedBox(
child: CircularProgressIndicator(), child: CircularProgressIndicator(),
), ),
); );
final loadingIcon = IconButton(onPressed: () {}, icon: centerLoading);