feat: adapt mobile extension list (#242)

This commit is contained in:
Levi authored and GitHub committed 2023-10-21 16:36:22 +08:00
1 parent 74c9491893
commit aab4a37a7e
4 files changed
+42 -13

No files matched your search

@@ -12,6 +12,12 @@ class FileItem {
FileItem(this.isDirectory, this.path, this.name, this.size);
String get fullPath => "${path == "/" ? path : "$path/"}$name";
String filePath(String optName) {
return optName.isEmpty
? fullPath
: "${path == "/" ? path : "$path/"}$optName";
}
}
class TaskFilesController extends GetxController {
@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:open_file/open_file.dart';
import 'package:path/path.dart';
import 'package:share_plus/share_plus.dart';
import '../../../../util/file_icon.dart';
@@ -52,13 +53,17 @@ class TaskFilesView extends GetView<TaskFilesController> {
itemBuilder: (context, index) {
final meta = controller.task.value!.meta;
final file = fileList[index];
final filePath = Util.safePathJoin(
[meta.opts.path, meta.res!.name, file.fullPath]);
final filePath = Util.safePathJoin([
meta.opts.path,
meta.res!.name,
file.filePath(meta.opts.name)
]);
final fileName = basename(filePath);
return ListTile(
leading: file.isDirectory
? const Icon(Icons.folder)
: Icon(FaIcons.allIcons[findIcon(file.name)]),
title: Text(fileList[index].name),
title: Text(fileName),
subtitle: file.isDirectory
? Text('items'.trParams({
'count': controller