mirror of
https://github.com/lifegpc/eh_downloader_flutter.git
synced 2026-07-08 01:30:28 +08:00
feat: 添加画廊列表显示模式和合并功能,优化画廊列表卡片组件
This commit is contained in:
@@ -239,10 +239,10 @@ class GMetaSearchInfo {
|
||||
}
|
||||
|
||||
class GalleryThumbnails {
|
||||
const GalleryThumbnails({
|
||||
GalleryThumbnails({
|
||||
required this.thumbnails,
|
||||
});
|
||||
final Map<int, ApiResult<ExtendedPMeta>> thumbnails;
|
||||
Map<int, ApiResult<ExtendedPMeta>> thumbnails;
|
||||
factory GalleryThumbnails.fromJson(Map<String, dynamic> json) =>
|
||||
GalleryThumbnails(
|
||||
thumbnails: json.map((key, value) => MapEntry(
|
||||
@@ -251,4 +251,17 @@ class GalleryThumbnails {
|
||||
value as Map<String, dynamic>,
|
||||
(json) =>
|
||||
ExtendedPMeta.fromJson(json as Map<String, dynamic>)))));
|
||||
void merge(GalleryThumbnails another) {
|
||||
another.thumbnails.forEach((key, value) {
|
||||
if (thumbnails.containsKey(key)) {
|
||||
if (value.ok) {
|
||||
thumbnails[key] = value;
|
||||
} else if (!thumbnails[key]!.ok) {
|
||||
thumbnails[key] = value;
|
||||
}
|
||||
} else {
|
||||
thumbnails[key] = value;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user