feat: file open on mobile (#223)

This commit is contained in:
Levi authored and GitHub committed 2023-09-20 16:29:08 +08:00
1 parent d28fcef0a7
commit 3459b474db
4 files changed
+103 -10

No files matched your search

@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:open_file/open_file.dart';
import 'package:share_plus/share_plus.dart';
import '../../../../util/file_icon.dart';
@@ -65,16 +66,35 @@ class TaskFilesView extends GetView<TaskFilesController> {
: Text(Util.fmtByte(file.size)),
trailing: file.isDirectory
? null
: IconButton(
icon: const Icon(Icons.share),
onPressed: () {
final xfile = XFile(Util.safePathJoin([
meta.opts.path,
meta.res.rootDir,
file.fullPath
]));
Share.shareXFiles([xfile]);
}),
: SizedBox(
width: 100,
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
IconButton(
icon: const Icon(Icons.play_circle),
onPressed: () {
OpenFile.open(
Util.safePathJoin([
meta.opts.path,
meta.res.rootDir,
file.fullPath
]),
);
}),
IconButton(
icon: const Icon(Icons.share),
onPressed: () {
final xfile = XFile(Util.safePathJoin([
meta.opts.path,
meta.res.rootDir,
file.fullPath
]));
Share.shareXFiles([xfile]);
})
],
),
),
onTap: () {
if (file.isDirectory) {
controller.toDir(file.fullPath);
+64
View File
@@ -9,6 +9,7 @@ class AppTranslation {
'ja_JP': Locales.ja_JP,
'ru_RU': Locales.ru_RU,
'zh_CN': Locales.zh_CN,
'zh_TW': Locales.zh_TW,
};
}
@@ -389,4 +390,67 @@ class Locales {
'newVersionUpdate': '立即下载',
'newVersionLater': '稍后再说',
};
static const zh_TW = {
'label': '中文(正體)',
'error': '錯誤',
'tip': '提示',
'confirm': '確定',
'cancel': '取消',
'selectAll': '全選',
'task': '任務',
'downloading': '下載中',
'downloaded': '已完成',
'setting': '設定',
'donate': '斗內',
'exit': '離開',
'create': '新建任務',
'advancedOptions': '進階選項',
'downloadLink': '下載鏈接',
'downloadLinkValid': '請輸入下載鏈接',
'downloadLinkHit': '請輸入下載鏈接,支援 HTTP/HTTPS/MAGNET@append',
'downloadLinkHitDesktop': ',也可以通過拖拽Torrent文件至此以新增任務',
'download': '下載',
'noFileSelected': '沒有選取的文件',
'noStoragePermission': '沒有存儲權限',
'selectFile': '選擇文件',
'rename': '重命名',
'basic': '基礎',
'advanced': '進階',
'general': '一般',
'downloadDir': '下載目録',
'downloadDirValid': '請選擇下載目録',
'connections': '同時連接數量',
'maxRunning': '最大同時下載數',
'items': '@count 項',
'subscribeTracker': '訂閲 Tracker',
'subscribeFail': '訂閲失敗',
'update': '更新',
'updateDaily': '每日自動更新',
'lastUpdate': '上次更新:@time',
'addTracker': '新增 Tracker',
'addTrackerHit': '請輸入 Tracker 服務器地址,每行一條',
'ui': 'UI',
'theme': '佈景主題',
'themeSystem': '跟隨系統',
'themeLight': '亮色主題',
'themeDark': '暗色主題',
'locale': '語言',
'about': '關於',
'homepage': '首頁',
'version': '版本',
'protocol': '通訊協定',
'port': '端口',
'apiToken': '接口 Token',
'notSet': '尚未設定',
'set': '已設定',
'effectAfterRestart': '該選項將在重新啓動軟體後生效',
'startAll': '全部開始',
'pauseAll': '全部暫停',
'deleteTask': '刪除任務',
'deleteTaskTip': '保留已經下載的文件',
'delete': '刪除',
'newVersionTitle': '發現新版本 @version',
'newVersionUpdate': '立刻更新',
'newVersionLater': '稍後更新',
};
}
+8
View File
@@ -565,6 +565,14 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.4"
open_file:
dependency: "direct main"
description:
name: open_file
sha256: a5a32d44acb7c899987d0999e1e3cbb0a0f1adebbf41ac813ec6d2d8faa0af20
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.3.2"
package_config:
dependency: transitive
description:
+1
View File
@@ -59,6 +59,7 @@ dependencies:
tray_manager: ^0.2.0
autoscale_tabbarview: ^1.0.2
share_plus: ^7.1.0
open_file: ^3.3.2
dev_dependencies:
flutter_test:
sdk: flutter