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

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

View File

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

View File

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