mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-13 20:03:46 +00:00
feat: task file manage (#196)
1. support view task file list 2. support share file on android and iOS
This commit is contained in:
14 files changed
+312
-14
No files matched your search
@@ -0,0 +1,59 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
class Breadcrumb extends StatelessWidget {
|
||||
final List<String> items;
|
||||
final Function(int)? onItemTap;
|
||||
final TextStyle textStyle;
|
||||
final TextStyle activeTextStyle;
|
||||
|
||||
const Breadcrumb({
|
||||
super.key,
|
||||
required this.items,
|
||||
this.onItemTap,
|
||||
this.textStyle = const TextStyle(fontSize: 16),
|
||||
this.activeTextStyle =
|
||||
const TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
List<Widget> children = [];
|
||||
for (int i = 0; i < items.length; i++) {
|
||||
children.add(
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
if (onItemTap != null) {
|
||||
onItemTap!(i);
|
||||
}
|
||||
},
|
||||
child: Text(
|
||||
items[i],
|
||||
style: i == items.length - 1 ? activeTextStyle : textStyle,
|
||||
),
|
||||
),
|
||||
);
|
||||
if (i != items.length - 1) {
|
||||
children.add(const Text(" > "));
|
||||
}
|
||||
}
|
||||
return Row(
|
||||
children: [
|
||||
...(children.length == 1
|
||||
? children.sublist(0, 1)
|
||||
: children.sublist(0, 2)),
|
||||
children.length > 2
|
||||
? Expanded(
|
||||
child: SingleChildScrollView(
|
||||
reverse: true,
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: Row(
|
||||
children: children.sublist(2),
|
||||
),
|
||||
),
|
||||
)
|
||||
: null,
|
||||
].where((e) => e != null).map((e) => e!).toList(),
|
||||
).paddingOnly(right: 12);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
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';
|
||||
@@ -109,11 +108,16 @@ class BuildTaskListView extends GetView {
|
||||
List<Widget> buildActions() {
|
||||
final list = <Widget>[];
|
||||
if (isDone()) {
|
||||
if (Util.isDesktop()) {
|
||||
if (Util.isDesktop() || Util.isMobile()) {
|
||||
list.add(IconButton(
|
||||
icon: const Icon(Icons.folder_open),
|
||||
onPressed: () async {
|
||||
await FileExplorer.openAndSelectFile(buildExplorerUrl(task));
|
||||
onPressed: () {
|
||||
if (Util.isDesktop()) {
|
||||
FileExplorer.openAndSelectFile(buildExplorerUrl(task));
|
||||
} else {
|
||||
Get.rootDelegate
|
||||
.toNamed(Routes.TASK_FILES, parameters: {'id': task.id});
|
||||
}
|
||||
},
|
||||
));
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ class _DirectorySelectorState extends State<DirectorySelector> {
|
||||
children: [
|
||||
Expanded(
|
||||
child: TextFormField(
|
||||
readOnly: Util.isWeb() && !Util.isIOS() ? false : true,
|
||||
readOnly: Util.isWeb() ? false : true,
|
||||
controller: widget.controller,
|
||||
decoration: widget.showLabel
|
||||
? InputDecoration(
|
||||
|
||||
Reference in new issue
Block a user