mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-18 15:54:35 +01:00
fix & opt
- sftp download unknown spent time - shareFiles return bool
This commit is contained in:
@@ -301,7 +301,7 @@ class _ServerPageState extends State<ServerPage>
|
||||
String? failedInfo) {
|
||||
switch (cs) {
|
||||
case ServerConnectionState.disconnected:
|
||||
return 'Disconnected';
|
||||
return s.disconnected;
|
||||
case ServerConnectionState.connected:
|
||||
if (temp == '') {
|
||||
if (upTime == '') {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:share_plus/share_plus.dart';
|
||||
import 'package:toolbox/core/extension/colorx.dart';
|
||||
import 'package:toolbox/core/extension/numx.dart';
|
||||
import 'package:toolbox/core/extension/stringx.dart';
|
||||
@@ -173,8 +172,7 @@ class _SFTPDownloadedPageState extends State<SFTPDownloadedPage> {
|
||||
leading: const Icon(Icons.open_in_new),
|
||||
title: Text(s.open),
|
||||
onTap: () {
|
||||
Share.shareFiles([file.absolute.path],
|
||||
text: '$fileName from ServerBox');
|
||||
shareFiles(context, [file.absolute.path]);
|
||||
}),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:share_plus/share_plus.dart';
|
||||
import 'package:toolbox/core/extension/numx.dart';
|
||||
import 'package:toolbox/core/utils.dart';
|
||||
import 'package:toolbox/data/model/sftp/download_status.dart';
|
||||
@@ -77,11 +76,11 @@ class _SFTPDownloadingPageState extends State<SFTPDownloadingPage> {
|
||||
}
|
||||
switch (status.status) {
|
||||
case SftpWorkerStatus.finished:
|
||||
final time = status.spentTime.toString();
|
||||
return _wrapInCard(status,
|
||||
'${s.downloadFinished} ${s.spentTime(status.spentTime ?? s.unknown)}',
|
||||
'${s.downloadFinished} ${s.spentTime(time == 'null' ? s.unknown : (time.substring(0, time.length - 7)))}',
|
||||
trailing: IconButton(
|
||||
onPressed: () => Share.shareFiles([status.item.localPath],
|
||||
text: '${status.fileName} from ServerBox'),
|
||||
onPressed: () => shareFiles(context, [status.item.localPath]),
|
||||
icon: const Icon(Icons.open_in_new)));
|
||||
case SftpWorkerStatus.downloading:
|
||||
return _wrapInCard(
|
||||
|
||||
@@ -195,7 +195,8 @@ class _SFTPPageState extends State<SFTPPage> {
|
||||
}
|
||||
|
||||
void download(BuildContext context, SftpName name) {
|
||||
showRoundDialog(context, s.download, Text(s.dl2Local(name.filename)), [
|
||||
showRoundDialog(context, s.download,
|
||||
Text('${s.dl2Local(name.filename)}\n${s.keepForeground}'), [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(), child: Text(s.cancel)),
|
||||
TextButton(
|
||||
|
||||
Reference in New Issue
Block a user