mirror of
https://github.com/qinglong-app/qinglong_app.git
synced 2025-10-09 16:48:19 +08:00
同步ios的功能
This commit is contained in:
@@ -6,20 +6,30 @@ class TaskLogBean {
|
||||
String? name;
|
||||
bool? isDir;
|
||||
List<String>? files;
|
||||
List<Children>? children;
|
||||
|
||||
TaskLogBean({this.name, this.isDir, this.files});
|
||||
TaskLogBean({this.name, this.files});
|
||||
|
||||
TaskLogBean.fromJson(Map<String, dynamic> json) {
|
||||
name = json['name'];
|
||||
isDir = json['isDir'];
|
||||
files = json['files'].cast<String>();
|
||||
name = json['name'] ?? json['title'];
|
||||
isDir = json['isDir'] ?? (json['type'] == "directory");
|
||||
|
||||
files = json['files']?.cast<String>();
|
||||
if (json['children'] != null) {
|
||||
children = <Children>[];
|
||||
json['children'].forEach((v) {
|
||||
children!.add(Children.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['name'] = this.name;
|
||||
data['isDir'] = this.isDir;
|
||||
data['files'] = this.files;
|
||||
if (this.children != null) {
|
||||
data['children'] = this.children!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
@@ -27,3 +37,31 @@ class TaskLogBean {
|
||||
return TaskLogBean.fromJson(json);
|
||||
}
|
||||
}
|
||||
|
||||
class Children {
|
||||
String? title;
|
||||
String? value;
|
||||
String? type;
|
||||
String? key;
|
||||
String? parent;
|
||||
|
||||
Children({this.title, this.value, this.type, this.key, this.parent});
|
||||
|
||||
Children.fromJson(Map<String, dynamic> json) {
|
||||
title = json['title'];
|
||||
value = json['value'];
|
||||
type = json['type'];
|
||||
key = json['key'];
|
||||
parent = json['parent'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['title'] = this.title;
|
||||
data['value'] = this.value;
|
||||
data['type'] = this.type;
|
||||
data['key'] = this.key;
|
||||
data['parent'] = this.parent;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,40 +43,66 @@ class _TaskLogPageState extends ConsumerState<TaskLogPage> with LazyLoadState<Ta
|
||||
color: ref.watch(themeProvider).themeColor.settingBgColor(),
|
||||
child: (item.isDir ?? false)
|
||||
? ExpansionTile(
|
||||
title: Text(
|
||||
item.name ?? "",
|
||||
style: TextStyle(
|
||||
color: ref.watch(themeProvider).themeColor.titleColor(),
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
children: item.files!
|
||||
.map((e) => ListTile(
|
||||
onTap: () {
|
||||
Navigator.of(context).pushNamed(Routes.routeTaskLogDetail, arguments: item.name! + "/" + e);
|
||||
},
|
||||
title: Text(
|
||||
e,
|
||||
style: TextStyle(
|
||||
color: ref.watch(themeProvider).themeColor.titleColor(),
|
||||
fontSize: 14,
|
||||
),
|
||||
),
|
||||
))
|
||||
.toList(),
|
||||
)
|
||||
: ListTile(
|
||||
onTap: () {
|
||||
Navigator.of(context).pushNamed(Routes.routeTaskLogDetail, arguments: item.name);
|
||||
},
|
||||
title: Text(
|
||||
item.name ?? "",
|
||||
style: TextStyle(
|
||||
color: ref.watch(themeProvider).themeColor.titleColor(),
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
title: Text(
|
||||
item.name ?? "",
|
||||
style: TextStyle(
|
||||
color: ref.watch(themeProvider).themeColor.titleColor(),
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
children: (item.files?.isNotEmpty ?? false)
|
||||
? item.files!
|
||||
.map((e) => ListTile(
|
||||
onTap: () {
|
||||
Navigator.of(context).pushNamed(Routes.routeTaskLogDetail, arguments: {
|
||||
"path": item.name,
|
||||
"title": e,
|
||||
});
|
||||
},
|
||||
title: Text(
|
||||
e,
|
||||
style: TextStyle(
|
||||
color: ref.watch(themeProvider).themeColor.titleColor(),
|
||||
fontSize: 14,
|
||||
),
|
||||
),
|
||||
))
|
||||
.toList()
|
||||
: (item.children ?? [])
|
||||
.map((e) => ListTile(
|
||||
onTap: () {
|
||||
Navigator.of(context).pushNamed(Routes.routeTaskLogDetail, arguments: {
|
||||
"path": item.name,
|
||||
"title": e.title,
|
||||
});
|
||||
},
|
||||
title: Text(
|
||||
e.title ?? "",
|
||||
style: TextStyle(
|
||||
color: ref.watch(themeProvider).themeColor.titleColor(),
|
||||
fontSize: 14,
|
||||
),
|
||||
),
|
||||
))
|
||||
.toList(),
|
||||
)
|
||||
: ListTile(
|
||||
onTap: () {
|
||||
if (item.isDir ?? false) {
|
||||
"该文件夹为空".toast();
|
||||
return;
|
||||
}
|
||||
|
||||
Navigator.of(context).pushNamed(Routes.routeTaskLogDetail, arguments: item.name);
|
||||
},
|
||||
title: Text(
|
||||
item.name ?? "",
|
||||
style: TextStyle(
|
||||
color: ref.watch(themeProvider).themeColor.titleColor(),
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
itemCount: list.length,
|
||||
|
||||
Reference in New Issue
Block a user