diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index 7e6ec20..6f05afb 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -365,5 +365,6 @@ "message": "Message", "type": "Type", "level": "Level", - "galleryListDisplayMode": "Display mode for gallery list" + "galleryListDisplayMode": "Display mode for gallery list", + "noGalleriesFound": "No galleries found." } diff --git a/lib/l10n/app_zh.arb b/lib/l10n/app_zh.arb index 5a66c34..91493b5 100644 --- a/lib/l10n/app_zh.arb +++ b/lib/l10n/app_zh.arb @@ -365,5 +365,6 @@ "message": "消息", "type": "类型", "level": "级别", - "galleryListDisplayMode": "画廊列表的显示模式" + "galleryListDisplayMode": "画廊列表的显示模式", + "noGalleriesFound": "找不到画廊" } diff --git a/lib/pages/galleries.dart b/lib/pages/galleries.dart index c196d35..fa23bbf 100644 --- a/lib/pages/galleries.dart +++ b/lib/pages/galleries.dart @@ -72,22 +72,24 @@ class _GalleriesPage extends State category: widget.category, tag: widget.tag)) .unwrap(); - final thumbnails = - (await api.getGalleriesThumbnail(list.map((e) => e.gid).toList())) - .unwrap(); - _thumbnails.merge(thumbnails); - final files = (await api.getFiles(list - .map((e) { - var thumbnail = _thumbnails.thumbnails[e.gid]; - if (thumbnail != null && thumbnail.ok) { - return thumbnail.unwrap().token; - } - }) - .where((t) => t != null) - .cast() - .toList())) - .unwrap(); - _files.merge(files); + if (list.isNotEmpty) { + final thumbnails = + (await api.getGalleriesThumbnail(list.map((e) => e.gid).toList())) + .unwrap(); + _thumbnails.merge(thumbnails); + final files = (await api.getFiles(list + .map((e) { + var thumbnail = _thumbnails.thumbnails[e.gid]; + if (thumbnail != null && thumbnail.ok) { + return thumbnail.unwrap().token; + } + }) + .where((t) => t != null) + .cast() + .toList())) + .unwrap(); + _files.merge(files); + } final isLastPage = list.length < _pageSize; if (isLastPage) { _pagingController.appendLastPage(list); @@ -268,6 +270,10 @@ class _GalleriesPage extends State extra: GalleryPageExtra(title: item.preferredTitle)); }, ); + }, noItemsFoundIndicatorBuilder: (context) { + return Center( + child: Text(i18n.noGalleriesFound, + style: Theme.of(context).textTheme.titleLarge)); }), ))); }