mirror of
https://github.com/lifegpc/eh_downloader_flutter.git
synced 2026-07-08 01:30:28 +08:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -1,8 +1,12 @@
|
|||||||
|
import 'package:flutter/gestures.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
import '../api/file.dart';
|
import '../api/file.dart';
|
||||||
import '../api/gallery.dart';
|
import '../api/gallery.dart';
|
||||||
import '../globals.dart';
|
import '../globals.dart';
|
||||||
|
import '../main.dart';
|
||||||
|
import 'rate.dart';
|
||||||
import 'thumbnail.dart';
|
import 'thumbnail.dart';
|
||||||
|
|
||||||
class GalleryListNormalCard extends StatefulWidget {
|
class GalleryListNormalCard extends StatefulWidget {
|
||||||
@@ -30,46 +34,106 @@ class _GalleryListNormalCard extends State<GalleryListNormalCard> {
|
|||||||
final maxWidth = MediaQuery.of(context).size.width;
|
final maxWidth = MediaQuery.of(context).size.width;
|
||||||
bool useMobile = maxWidth <= 810;
|
bool useMobile = maxWidth <= 810;
|
||||||
final max =
|
final max =
|
||||||
((useMobile ? 300 : 400) * MediaQuery.of(context).devicePixelRatio)
|
((useMobile ? 150 : 200) * MediaQuery.of(context).devicePixelRatio)
|
||||||
.toInt();
|
.toInt();
|
||||||
final fileId =
|
final fileId =
|
||||||
_pMeta != null ? _files?.files[_pMeta!.token]?.firstOrNull?.id : null;
|
_pMeta != null ? _files?.files[_pMeta!.token]?.firstOrNull?.id : null;
|
||||||
final card = Card(
|
final locale = MainApp.of(context).lang.toLocale().toString();
|
||||||
child: Row(children: [
|
final cs = Theme.of(context).colorScheme;
|
||||||
Expanded(
|
final thumbnailWidget = _pMeta != null
|
||||||
flex: useMobile ? 2 : 3,
|
? Thumbnail(_pMeta!,
|
||||||
child: _pMeta != null
|
key: Key("thumbnail-conver-${widget.gMeta.gid}-$max"),
|
||||||
? Thumbnail(_pMeta!,
|
files: _files,
|
||||||
key: Key("thumbnail-conver-${widget.gMeta.gid}-$max"),
|
gid: widget.gMeta.gid,
|
||||||
files: _files,
|
fileId: fileId,
|
||||||
gid: widget.gMeta.gid,
|
height: max)
|
||||||
fileId: fileId,
|
: Container();
|
||||||
max: max)
|
final mainWidget = Padding(
|
||||||
: Container()),
|
padding: useMobile
|
||||||
Expanded(
|
? const EdgeInsets.symmetric(vertical: 2, horizontal: 8)
|
||||||
flex: useMobile ? 3 : 7,
|
: const EdgeInsets.all(16),
|
||||||
child: Padding(
|
child: Column(crossAxisAlignment: CrossAxisAlignment.center, children: [
|
||||||
padding: const EdgeInsets.all(8.0),
|
SelectableText(
|
||||||
child: Column(
|
useMobile ? widget.gMeta.preferredTitle : widget.gMeta.title,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
style: TextStyle(
|
||||||
children: [
|
fontWeight: FontWeight.bold, fontSize: 16, color: cs.primary),
|
||||||
Text(widget.gMeta.title),
|
textAlign: TextAlign.center,
|
||||||
Text(widget.gMeta.titleJpn),
|
minLines: useMobile ? 1 : 1,
|
||||||
Text(widget.gMeta.uploader),
|
maxLines: useMobile
|
||||||
Text(widget.gMeta.category),
|
? 3
|
||||||
Text(widget.gMeta.filecount.toString()),
|
: widget.gMeta.titleJpn.isEmpty
|
||||||
Text(widget.gMeta.rating.toString()),
|
? 4
|
||||||
])))
|
: 2),
|
||||||
]));
|
useMobile || widget.gMeta.titleJpn.isEmpty
|
||||||
final box = SizedBox(
|
? Container()
|
||||||
height: useMobile ? 300 : 400,
|
: SelectableText(
|
||||||
width: useMobile ? null : 600,
|
widget.gMeta.titleJpn,
|
||||||
child: card);
|
style: TextStyle(color: cs.secondary),
|
||||||
return InkWell(
|
textAlign: TextAlign.center,
|
||||||
onTap: () {
|
maxLines: 2,
|
||||||
context.push('/gallery/${widget.gMeta.gid}',
|
minLines: 1,
|
||||||
extra: GalleryPageExtra(title: widget.gMeta.preferredTitle));
|
),
|
||||||
},
|
Expanded(child: Container()),
|
||||||
child: box);
|
Row(crossAxisAlignment: CrossAxisAlignment.end, children: [
|
||||||
|
Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||||
|
SelectableText.rich(TextSpan(
|
||||||
|
text: widget.gMeta.uploader,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: cs.primary),
|
||||||
|
mouseCursor: SystemMouseCursors.click,
|
||||||
|
recognizer: TapGestureRecognizer()
|
||||||
|
..onTap = () {
|
||||||
|
context.pushNamed("/galleries",
|
||||||
|
queryParameters: {"uploader": widget.gMeta.uploader});
|
||||||
|
})),
|
||||||
|
Rate(widget.gMeta.rating, fontSize: 14, selectable: true),
|
||||||
|
SelectableText.rich(TextSpan(
|
||||||
|
text: widget.gMeta.category,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: cs.primary),
|
||||||
|
mouseCursor: SystemMouseCursors.click,
|
||||||
|
recognizer: TapGestureRecognizer()
|
||||||
|
..onTap = () {
|
||||||
|
context.pushNamed("/galleries",
|
||||||
|
queryParameters: {"category": widget.gMeta.category});
|
||||||
|
}))
|
||||||
|
]),
|
||||||
|
Expanded(child: Container()),
|
||||||
|
Column(crossAxisAlignment: CrossAxisAlignment.end, children: [
|
||||||
|
SelectableText("${widget.gMeta.filecount}P",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
color: cs.primary,
|
||||||
|
fontWeight: FontWeight.bold)),
|
||||||
|
SelectableText(
|
||||||
|
DateFormat.yMd(locale)
|
||||||
|
.add_jms()
|
||||||
|
.format(widget.gMeta.posted.toLocal()),
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
color: cs.primary,
|
||||||
|
fontWeight: FontWeight.bold))
|
||||||
|
]),
|
||||||
|
]),
|
||||||
|
]));
|
||||||
|
final box = Container(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: SizedBox(
|
||||||
|
height: useMobile ? 150 : 200,
|
||||||
|
width: useMobile ? null : 800,
|
||||||
|
child: Row(children: [
|
||||||
|
useMobile
|
||||||
|
? ConstrainedBox(
|
||||||
|
constraints: BoxConstraints(maxWidth: maxWidth / 2),
|
||||||
|
child: thumbnailWidget)
|
||||||
|
: thumbnailWidget,
|
||||||
|
Expanded(child: mainWidget),
|
||||||
|
])));
|
||||||
|
final card = Card(child: box);
|
||||||
|
return card;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -237,9 +237,15 @@ class _GalleriesPage extends State<GalleriesPage>
|
|||||||
final displayMode = GalleryListDisplayMode
|
final displayMode = GalleryListDisplayMode
|
||||||
.values[prefs.getInt("galleryListDisplayMode") ?? 1];
|
.values[prefs.getInt("galleryListDisplayMode") ?? 1];
|
||||||
if (displayMode == GalleryListDisplayMode.normal) {
|
if (displayMode == GalleryListDisplayMode.normal) {
|
||||||
return GalleryListNormalCard(item,
|
return InkWell(
|
||||||
files: _files,
|
onTap: () {
|
||||||
pMeta: _thumbnails.thumbnails[item.gid]?.unwrapOrNull());
|
context.push("/gallery/${item.gid}",
|
||||||
|
extra: GalleryPageExtra(title: item.preferredTitle));
|
||||||
|
},
|
||||||
|
mouseCursor: SystemMouseCursors.basic,
|
||||||
|
child: GalleryListNormalCard(item,
|
||||||
|
files: _files,
|
||||||
|
pMeta: _thumbnails.thumbnails[item.gid]?.unwrapOrNull()));
|
||||||
}
|
}
|
||||||
return ListTile(
|
return ListTile(
|
||||||
title: Text(item.preferredTitle),
|
title: Text(item.preferredTitle),
|
||||||
|
|||||||
Reference in New Issue
Block a user