mirror of
https://github.com/lifegpc/eh_downloader_flutter.git
synced 2026-07-08 01:30:28 +08:00
Update gallery page for desktop
This commit is contained in:
@@ -1,9 +1,39 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
import '../api/gallery.dart';
|
import '../api/gallery.dart';
|
||||||
|
import '../main.dart';
|
||||||
import 'tags.dart';
|
import 'tags.dart';
|
||||||
import 'thumbnail.dart';
|
import 'thumbnail.dart';
|
||||||
|
|
||||||
|
class _KeyValue extends StatelessWidget {
|
||||||
|
const _KeyValue(this.name, this.value,
|
||||||
|
{Key? key, this.maxLines, this.minLines, this.fontSize})
|
||||||
|
: super(key: key);
|
||||||
|
final String name;
|
||||||
|
final String value;
|
||||||
|
final int? maxLines;
|
||||||
|
final int? minLines;
|
||||||
|
final double? fontSize;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final cs = Theme.of(context).colorScheme;
|
||||||
|
return Row(children: [
|
||||||
|
SizedBox(
|
||||||
|
width: 60,
|
||||||
|
child: Text(name,
|
||||||
|
style: TextStyle(color: cs.primary, fontSize: fontSize))),
|
||||||
|
Expanded(
|
||||||
|
child: SelectableText(value,
|
||||||
|
style: TextStyle(color: cs.secondary, fontSize: fontSize),
|
||||||
|
maxLines: maxLines,
|
||||||
|
minLines: minLines),
|
||||||
|
)
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class GalleryInfoDesktop extends StatelessWidget {
|
class GalleryInfoDesktop extends StatelessWidget {
|
||||||
const GalleryInfoDesktop(this.gData, {Key? key, this.fileId, this.controller})
|
const GalleryInfoDesktop(this.gData, {Key? key, this.fileId, this.controller})
|
||||||
: super(key: key);
|
: super(key: key);
|
||||||
@@ -14,6 +44,8 @@ class GalleryInfoDesktop extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final cs = Theme.of(context).colorScheme;
|
final cs = Theme.of(context).colorScheme;
|
||||||
|
final i18n = AppLocalizations.of(context)!;
|
||||||
|
final locale = MainApp.of(context).lang.toLocale().toString();
|
||||||
return Container(
|
return Container(
|
||||||
alignment: Alignment.topCenter,
|
alignment: Alignment.topCenter,
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
@@ -45,8 +77,24 @@ class GalleryInfoDesktop extends StatelessWidget {
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
width: 170,
|
width: 170,
|
||||||
child: Column(children: [
|
child: Column(children: [
|
||||||
SelectableText(gData.meta.category),
|
SelectableText(gData.meta.category,
|
||||||
SelectableText(gData.meta.uploader),
|
style: TextStyle(color: cs.secondary)),
|
||||||
|
SelectableText(gData.meta.uploader,
|
||||||
|
style: TextStyle(color: cs.secondary)),
|
||||||
|
_KeyValue(
|
||||||
|
"${i18n.posted}${i18n.colon}",
|
||||||
|
DateFormat.yMd(locale)
|
||||||
|
.add_jms()
|
||||||
|
.format(gData.meta.posted),
|
||||||
|
maxLines: 2,
|
||||||
|
minLines: 1,
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
|
_KeyValue(
|
||||||
|
"${i18n.visible}${i18n.colon}",
|
||||||
|
gData.meta.expunged ? i18n.no : i18n.yes,
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
])),
|
])),
|
||||||
const VerticalDivider(indent: 10, endIndent: 10),
|
const VerticalDivider(indent: 10, endIndent: 10),
|
||||||
Expanded(child: TagsPanel(gData.tags)),
|
Expanded(child: TagsPanel(gData.tags)),
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ class _Thumbnail extends State<Thumbnail> {
|
|||||||
String _dir = "";
|
String _dir = "";
|
||||||
Color? _iconColor;
|
Color? _iconColor;
|
||||||
double? _iconSize;
|
double? _iconSize;
|
||||||
|
bool _disposed = false;
|
||||||
Future<void> _fetchData() async {
|
Future<void> _fetchData() async {
|
||||||
try {
|
try {
|
||||||
_cancel = CancelToken();
|
_cancel = CancelToken();
|
||||||
@@ -135,11 +136,13 @@ class _Thumbnail extends State<Thumbnail> {
|
|||||||
center: Offset(i.width / 2, i.height / 2),
|
center: Offset(i.width / 2, i.height / 2),
|
||||||
width: iconSize,
|
width: iconSize,
|
||||||
height: iconSize));
|
height: iconSize));
|
||||||
setState(() {
|
if (!_disposed) {
|
||||||
_iconColor = pattle.colors.first.computeLuminance() > 0.5
|
setState(() {
|
||||||
? Colors.black
|
_iconColor = pattle.colors.first.computeLuminance() > 0.5
|
||||||
: Colors.white;
|
? Colors.black
|
||||||
});
|
: Colors.white;
|
||||||
|
});
|
||||||
|
}
|
||||||
} finally {
|
} finally {
|
||||||
i.dispose();
|
i.dispose();
|
||||||
}
|
}
|
||||||
@@ -155,6 +158,7 @@ class _Thumbnail extends State<Thumbnail> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
|
_disposed = true;
|
||||||
_cancel?.cancel();
|
_cancel?.cancel();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,5 +36,9 @@
|
|||||||
"sortByGid": "Sort by gallery id",
|
"sortByGid": "Sort by gallery id",
|
||||||
"asc": "Ascending",
|
"asc": "Ascending",
|
||||||
"desc": "Descending",
|
"desc": "Descending",
|
||||||
"saveAs": "Save As"
|
"saveAs": "Save As",
|
||||||
|
"posted": "Posted",
|
||||||
|
"visible": "Visible",
|
||||||
|
"yes": "Yes",
|
||||||
|
"no": "No"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,5 +36,9 @@
|
|||||||
"sortByGid": "按画廊ID排序",
|
"sortByGid": "按画廊ID排序",
|
||||||
"asc": "升序",
|
"asc": "升序",
|
||||||
"desc": "降序",
|
"desc": "降序",
|
||||||
"saveAs": "另存为"
|
"saveAs": "另存为",
|
||||||
|
"posted": "上传时间",
|
||||||
|
"visible": "可见性",
|
||||||
|
"yes": "是",
|
||||||
|
"no": "否"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user