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);