feat: create task with advanced options (#157)

This commit is contained in:
Levi authored and GitHub committed 2023-07-19 22:52:51 +08:00
1 parent eb79dd5ac5
commit 7376e85895
22 files changed
+357 -136

No files matched your search

@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:gopeed/api/model/meta.dart';
import 'package:gopeed/api/model/resource.dart';
import 'package:path/path.dart' as path;
import '../../api/api.dart';
@@ -190,7 +191,7 @@ class BuildTaskListView extends GetView {
: const SizedBox.shrink(),
ListTile(
// isThreeLine: true,
title: Text(task.meta.res.name,
title: Text(fileName(task.meta),
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: Get.textTheme.titleSmall),
@@ -199,9 +200,9 @@ class BuildTaskListView extends GetView {
style: context.textTheme.bodyLarge
?.copyWith(color: Get.theme.disabledColor),
),
leading: task.meta.res.name.lastIndexOf('.') == -1
? const Icon(FaIcons.file)
: Icon(FaIcons.allIcons[findIcon(task.meta.res.name)]),
leading: (task.meta.res.rootDir.isNotEmpty
? const Icon(FaIcons.folder)
: Icon(FaIcons.allIcons[findIcon(fileName(task.meta))])),
trailing: SizedBox(
width: 180,
@@ -220,4 +221,11 @@ class BuildTaskListView extends GetView {
])
]));
}
String fileName(Meta meta) {
if (meta.res.files.length > 1) {
return meta.res.name;
}
return meta.opts.name.isEmpty ? meta.res.files[0].name : meta.opts.name;
}
}