mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-08 17:40:28 +00:00
feat: adapt mobile extension list (#242)
This commit is contained in:
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
|
||||
|
||||
Reference in new issue
Block a user