diff --git a/lib/components/comic.dart b/lib/components/comic.dart index 268f1b6..9f9ee4c 100644 --- a/lib/components/comic.dart +++ b/lib/components/comic.dart @@ -253,18 +253,34 @@ class ComicTile extends StatelessWidget { child: buildImage(context), ), ), - Positioned( - bottom: 0, - right: 0, - child: Padding( + Align( + alignment: Alignment.bottomRight, + child: (() { + 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( - horizontal: 4, vertical: 4), + horizontal: 2, vertical: 2), child: ClipRRect( - borderRadius: const BorderRadius.only( - topLeft: Radius.circular(10.0), - topRight: Radius.circular(10.0), - bottomRight: Radius.circular(10.0), - bottomLeft: Radius.circular(10.0), + borderRadius: const BorderRadius.all( + Radius.circular(10.0), ), child: Container( color: Colors.black.withOpacity(0.5), @@ -273,19 +289,13 @@ class ComicTile extends StatelessWidget { const EdgeInsets.fromLTRB(8, 6, 8, 6), child: ConstrainedBox( constraints: BoxConstraints( - maxWidth: constraints.maxWidth * 0.88, + maxWidth: constraints.maxWidth, ), child: Text( - comic.description.isEmpty - ? comic.subtitle - ?.replaceAll('\n', '') ?? - '' - : comic.description - .split('|') - .join('\n'), - style: const TextStyle( + text, + style: TextStyle( fontWeight: FontWeight.w500, - fontSize: 12, + fontSize: fortSize, color: Colors.white, ), textAlign: TextAlign.right, @@ -296,7 +306,9 @@ class ComicTile extends StatelessWidget { ), ), ), - )), + ); + })(), + ), ], ), ), @@ -307,7 +319,6 @@ class ComicTile extends StatelessWidget { comic.title.replaceAll('\n', ''), style: const TextStyle( fontWeight: FontWeight.w500, - fontSize: 14.0, ), maxLines: 1, overflow: TextOverflow.ellipsis, diff --git a/lib/foundation/favorites.dart b/lib/foundation/favorites.dart index d6f245c..1ce41e7 100644 --- a/lib/foundation/favorites.dart +++ b/lib/foundation/favorites.dart @@ -75,7 +75,9 @@ class FavoriteItem implements Comic { @override 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 diff --git a/lib/pages/favorites/local_favorites_page.dart b/lib/pages/favorites/local_favorites_page.dart index 460aedd..628ed63 100644 --- a/lib/pages/favorites/local_favorites_page.dart +++ b/lib/pages/favorites/local_favorites_page.dart @@ -284,6 +284,7 @@ class _ReorderComicsPageState extends State<_ReorderComicsPage> { @override Widget build(BuildContext context) { + var type = appdata.settings['comicDisplayMode']; var tiles = comics.map( (e) { var comicSource = e.type.comicSource; @@ -296,7 +297,9 @@ class _ReorderComicsPageState extends State<_ReorderComicsPage> { e.id, e.author, e.tags, - "${e.time} | ${comicSource?.name ?? "Unknown"}", + type == 'detailed' + ? "${e.time} | ${comicSource?.name ?? "Unknown"}" + : "${e.type.comicSource?.name ?? "Unknown"} | ${e.time}", comicSource?.key ?? (e.type == ComicType.local ? "local" : "Unknown"), null,