Fix _buildBriefMode display (#58)

This commit is contained in:
AnxuNA
2024-11-20 09:33:33 +08:00
committed by GitHub
parent ce175a2135
commit c4aab2369f
3 changed files with 40 additions and 24 deletions

View File

@@ -253,18 +253,34 @@ class ComicTile extends StatelessWidget {
child: buildImage(context), child: buildImage(context),
), ),
), ),
Positioned( Align(
bottom: 0, alignment: Alignment.bottomRight,
right: 0, child: (() {
child: Padding( final subtitle =
comic.subtitle?.replaceAll('\n', '').trim();
final text = comic.description.isNotEmpty
? comic.description.split('|').join('\n')
: (subtitle?.isNotEmpty == true
? subtitle
: null);
final scale =
(appdata.settings['comicTileScale'] as num)
.toDouble();
final fortSize = scale < 0.85
? 8.0 // 小尺寸
: (scale < 1.0 ? 10.0 : 12.0);
if (text == null) {
return const SizedBox
.shrink(); // 如果没有文本,则不显示任何内容
}
return Padding(
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
horizontal: 4, vertical: 4), horizontal: 2, vertical: 2),
child: ClipRRect( child: ClipRRect(
borderRadius: const BorderRadius.only( borderRadius: const BorderRadius.all(
topLeft: Radius.circular(10.0), Radius.circular(10.0),
topRight: Radius.circular(10.0),
bottomRight: Radius.circular(10.0),
bottomLeft: Radius.circular(10.0),
), ),
child: Container( child: Container(
color: Colors.black.withOpacity(0.5), color: Colors.black.withOpacity(0.5),
@@ -273,19 +289,13 @@ class ComicTile extends StatelessWidget {
const EdgeInsets.fromLTRB(8, 6, 8, 6), const EdgeInsets.fromLTRB(8, 6, 8, 6),
child: ConstrainedBox( child: ConstrainedBox(
constraints: BoxConstraints( constraints: BoxConstraints(
maxWidth: constraints.maxWidth * 0.88, maxWidth: constraints.maxWidth,
), ),
child: Text( child: Text(
comic.description.isEmpty text,
? comic.subtitle style: TextStyle(
?.replaceAll('\n', '') ??
''
: comic.description
.split('|')
.join('\n'),
style: const TextStyle(
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
fontSize: 12, fontSize: fortSize,
color: Colors.white, color: Colors.white,
), ),
textAlign: TextAlign.right, textAlign: TextAlign.right,
@@ -296,7 +306,9 @@ class ComicTile extends StatelessWidget {
), ),
), ),
), ),
)), );
})(),
),
], ],
), ),
), ),
@@ -307,7 +319,6 @@ class ComicTile extends StatelessWidget {
comic.title.replaceAll('\n', ''), comic.title.replaceAll('\n', ''),
style: const TextStyle( style: const TextStyle(
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
fontSize: 14.0,
), ),
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,

View File

@@ -75,7 +75,9 @@ class FavoriteItem implements Comic {
@override @override
String get description { String get description {
return "$time | ${type == ComicType.local ? 'local' : type.comicSource?.name ?? "Unknown"}"; return appdata.settings['comicDisplayMode'] == 'detailed'
? "$time | ${type == ComicType.local ? 'local' : type.comicSource?.name ?? "Unknown"}"
: "${type.comicSource?.name ?? "Unknown"} | $time";
} }
@override @override

View File

@@ -284,6 +284,7 @@ class _ReorderComicsPageState extends State<_ReorderComicsPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
var type = appdata.settings['comicDisplayMode'];
var tiles = comics.map( var tiles = comics.map(
(e) { (e) {
var comicSource = e.type.comicSource; var comicSource = e.type.comicSource;
@@ -296,7 +297,9 @@ class _ReorderComicsPageState extends State<_ReorderComicsPage> {
e.id, e.id,
e.author, e.author,
e.tags, e.tags,
"${e.time} | ${comicSource?.name ?? "Unknown"}", type == 'detailed'
? "${e.time} | ${comicSource?.name ?? "Unknown"}"
: "${e.type.comicSource?.name ?? "Unknown"} | ${e.time}",
comicSource?.key ?? comicSource?.key ??
(e.type == ComicType.local ? "local" : "Unknown"), (e.type == ComicType.local ? "local" : "Unknown"),
null, null,