Skip to content

Commit

Permalink
Update task detail
Browse files Browse the repository at this point in the history
  • Loading branch information
lifegpc committed May 25, 2024
1 parent d2d4579 commit bcd95cf
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 23 deletions.
45 changes: 22 additions & 23 deletions lib/components/task.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,11 @@ class _TaskView extends State<TaskView> {
final i18n = AppLocalizations.of(context)!;
if (widget.task.base.type == TaskType.download) {
final gid = widget.task.base.gid;
return Row(children: [
Padding(
padding: const EdgeInsets.only(right: 8.0),
child: Text(i18n.downloadTask)),
Text(tasks.meta.containsKey(gid)
? tasks.meta[gid]!.preferredTitle
: gid.toString()),
]);
final title = tasks.meta.containsKey(gid)
? tasks.meta[gid]!.preferredTitle
: gid.toString();
return Text("${i18n.downloadTask} $title",
maxLines: 1, overflow: TextOverflow.ellipsis);
}
return Container();
}
Expand All @@ -95,21 +92,23 @@ class _TaskView extends State<TaskView> {
context.push("/dialog/task/${widget.task.base.id}");
},
behavior: HitTestBehavior.opaque,
child: Column(children: [
_buildText(context),
LinearPercentIndicator(
animation: true,
animateFromLastPercent: true,
animationDuration: 200,
progressColor: Colors.green,
lineHeight: 20.0,
barRadius: const Radius.circular(10),
padding: EdgeInsets.zero,
center: Text(percentText,
style: const TextStyle(color: Colors.black)),
percent: percent,
),
]))),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_buildText(context),
LinearPercentIndicator(
animation: true,
animateFromLastPercent: true,
animationDuration: 200,
progressColor: Colors.green,
lineHeight: 20.0,
barRadius: const Radius.circular(10),
padding: EdgeInsets.zero,
center: Text(percentText,
style: const TextStyle(color: Colors.black)),
percent: percent,
),
]))),
]),
);
}
Expand Down
31 changes: 31 additions & 0 deletions lib/dialog/task_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -83,20 +83,36 @@ class _TaskPage extends State<TaskPage> {
typ == TaskType.updateMeiliSearchData)) {
gid = i18n.allGalleries;
}
final maxWidth = MediaQuery.of(context).size.width;
final endIndent = maxWidth < 400 ? 5.0 : 10.0;
final indent = endIndent + 70;
return Column(
children: [
_KeyValue(i18n.taskId, widget.id.toString(), fontSize: 16),
Divider(indent: indent, endIndent: endIndent),
_KeyValue(i18n.taskType, typ.text(context), fontSize: 16),
Divider(indent: indent, endIndent: endIndent),
_KeyValue(i18n.gid, gid, fontSize: 16),
task.base.token.isEmpty
? Container()
: Divider(indent: indent, endIndent: endIndent),
task.base.token.isEmpty
? Container()
: _KeyValue(i18n.galleryToken, task.base.token, fontSize: 16),
Divider(indent: indent, endIndent: endIndent),
_KeyValue(i18n.processId, task.base.pid.toString(), fontSize: 16),
Divider(indent: indent, endIndent: endIndent),
_KeyValue(i18n.taskStatus, task.status.text(context), fontSize: 16),
task.fataled == null
? Container()
: Divider(indent: indent, endIndent: endIndent),
task.fataled == null
? Container()
: _KeyValue(i18n.fatalError, task.fataled! ? i18n.yes : i18n.no,
fontSize: 16),
task.error == null
? Container()
: Divider(indent: indent, endIndent: endIndent),
task.error == null
? Container()
: SelectableText(task.error!,
Expand Down Expand Up @@ -265,19 +281,34 @@ class _TaskPage extends State<TaskPage> {
}
final cs = Theme.of(context).colorScheme;
double? rating = double.tryParse(meta.rating);
final maxWidth = MediaQuery.of(context).size.width;
final endIndent = maxWidth < 400 ? 5.0 : 10.0;
final indent = endIndent + 70;
return Column(key: ValueKey("task_detail_meta_${widget.id}"), children: [
_KeyValue(i18n.title2, meta.title, fontSize: 16),
Divider(indent: indent, endIndent: endIndent),
_KeyValue(i18n.titleJpn, meta.titleJpn, fontSize: 16),
Divider(indent: indent, endIndent: endIndent),
_KeyValue(i18n.category, meta.category, fontSize: 16),
Divider(indent: indent, endIndent: endIndent),
_KeyValue(i18n.uploader, meta.uploader, fontSize: 16),
posted != null
? Divider(indent: indent, endIndent: endIndent)
: Container(),
posted != null
? _KeyValue(
i18n.posted, DateFormat.yMd(locale).add_jms().format(posted),
fontSize: 16)
: Container(),
Divider(indent: indent, endIndent: endIndent),
_KeyValue(i18n.pageLength, meta.filecount, fontSize: 16),
Divider(indent: indent, endIndent: endIndent),
_KeyValue(i18n.fileSize, getFileSize(meta.filesize), fontSize: 16),
Divider(indent: indent, endIndent: endIndent),
_KeyValue(i18n.visible, meta.expunged ? i18n.no : i18n.yes, fontSize: 16),
rating != null
? Divider(indent: indent, endIndent: endIndent)
: Container(),
rating != null
? Row(children: [
SizedBox(
Expand Down

0 comments on commit bcd95cf

Please sign in to comment.