diff --git a/lib/components/comic.dart b/lib/components/comic.dart index d39bc30..76aaebd 100644 --- a/lib/components/comic.dart +++ b/lib/components/comic.dart @@ -1196,7 +1196,6 @@ class ComicListState extends State { if (res.subData == null) { _maxPage = _data.length; } else { - print("next page: ${_data.length}"); _nextUrl = res.subData; } } @@ -1621,17 +1620,20 @@ class _SMClipper extends CustomClipper { } class SimpleComicTile extends StatelessWidget { - const SimpleComicTile({super.key, required this.comic, this.onTap}); + const SimpleComicTile( + {super.key, required this.comic, this.onTap, this.withTitle = false}); final Comic comic; final void Function()? onTap; + final bool withTitle; + @override Widget build(BuildContext context) { var image = _findImageProvider(comic); - var child = image == null + Widget child = image == null ? const SizedBox() : AnimatedImage( image: image, @@ -1641,7 +1643,18 @@ class SimpleComicTile extends StatelessWidget { filterQuality: FilterQuality.medium, ); - return AnimatedTapRegion( + child = Container( + width: 98, + height: 136, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8), + color: Theme.of(context).colorScheme.secondaryContainer, + ), + clipBehavior: Clip.antiAlias, + child: child, + ); + + child = AnimatedTapRegion( borderRadius: 8, onTap: onTap ?? () { @@ -1652,16 +1665,29 @@ class SimpleComicTile extends StatelessWidget { ), ); }, - child: Container( - width: 92, - height: 114, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(8), - color: Theme.of(context).colorScheme.secondaryContainer, - ), - clipBehavior: Clip.antiAlias, - child: child, - ), + child: child, ); + + if (withTitle) { + child = Column( + mainAxisSize: MainAxisSize.min, + children: [ + child, + const SizedBox(height: 4), + SizedBox( + width: 92, + child: Center( + child: Text( + comic.title.replaceAll('\n', ''), + maxLines: 1, + overflow: TextOverflow.ellipsis, + ), + ), + ), + ], + ); + } + + return child; } } diff --git a/lib/pages/aggregated_search_page.dart b/lib/pages/aggregated_search_page.dart index a84c471..75f66e2 100644 --- a/lib/pages/aggregated_search_page.dart +++ b/lib/pages/aggregated_search_page.dart @@ -90,7 +90,7 @@ class _SliverSearchResultState extends State<_SliverSearchResult> with AutomaticKeepAliveClientMixin { bool isLoading = true; - static const _kComicHeight = 132.0; + static const _kComicHeight = 162.0; get _comicWidth => _kComicHeight * 0.7; @@ -152,7 +152,7 @@ class _SliverSearchResultState extends State<_SliverSearchResult> } Widget buildComic(Comic c) { - return SimpleComicTile(comic: c) + return SimpleComicTile(comic: c, withTitle: true) .paddingLeft(_kLeftPadding) .paddingBottom(2); } diff --git a/lib/pages/home_page.dart b/lib/pages/home_page.dart index 94a281f..579e162 100644 --- a/lib/pages/home_page.dart +++ b/lib/pages/home_page.dart @@ -297,7 +297,7 @@ class _HistoryState extends State<_History> { ).paddingHorizontal(16), if (history.isNotEmpty) SizedBox( - height: 128, + height: 136, child: ListView.builder( scrollDirection: Axis.horizontal, itemCount: history.length, @@ -400,13 +400,14 @@ class _LocalState extends State<_Local> { ).paddingHorizontal(16), if (local.isNotEmpty) SizedBox( - height: 128, + height: 136, child: ListView.builder( scrollDirection: Axis.horizontal, itemCount: local.length, itemBuilder: (context, index) { return SimpleComicTile(comic: local[index]) - .paddingHorizontal(8); + .paddingHorizontal(8) + .paddingVertical(2); }, ), ).paddingHorizontal(8),