mirror of
https://github.com/venera-app/venera.git
synced 2025-09-27 07:47:24 +00:00
Add HistoryImageProvider
This commit is contained in:
@@ -78,33 +78,7 @@ class _HistoryPageState extends State<HistoryPage> {
|
||||
],
|
||||
),
|
||||
SliverGridComics(
|
||||
comics: comics.map(
|
||||
(e) {
|
||||
var cover = e.cover;
|
||||
if (!cover.isURL) {
|
||||
var localComic = LocalManager().find(
|
||||
e.id,
|
||||
e.type,
|
||||
);
|
||||
if(localComic != null) {
|
||||
cover = "file://${localComic.coverFile.path}";
|
||||
}
|
||||
}
|
||||
return Comic(
|
||||
e.title,
|
||||
cover,
|
||||
e.id,
|
||||
e.subtitle,
|
||||
null,
|
||||
getDescription(e),
|
||||
e.type == ComicType.local
|
||||
? 'local'
|
||||
: e.type.comicSource?.key ?? "Unknown:${e.type.value}",
|
||||
null,
|
||||
null,
|
||||
);
|
||||
},
|
||||
).toList(),
|
||||
comics: comics,
|
||||
badgeBuilder: (c) {
|
||||
return ComicSource.find(c.sourceKey)?.name;
|
||||
},
|
||||
|
@@ -7,6 +7,7 @@ import 'package:venera/foundation/consts.dart';
|
||||
import 'package:venera/foundation/favorites.dart';
|
||||
import 'package:venera/foundation/history.dart';
|
||||
import 'package:venera/foundation/image_provider/cached_image.dart';
|
||||
import 'package:venera/foundation/image_provider/history_image_provider.dart';
|
||||
import 'package:venera/foundation/image_provider/local_comic_image.dart';
|
||||
import 'package:venera/foundation/local.dart';
|
||||
import 'package:venera/pages/accounts_page.dart';
|
||||
@@ -265,21 +266,6 @@ class _HistoryState extends State<_History> {
|
||||
scrollDirection: Axis.horizontal,
|
||||
itemCount: history.length,
|
||||
itemBuilder: (context, index) {
|
||||
var cover = history[index].cover;
|
||||
ImageProvider imageProvider = CachedImageProvider(
|
||||
cover,
|
||||
sourceKey: history[index].type.comicSource?.key,
|
||||
cid: history[index].id,
|
||||
);
|
||||
if (!cover.isURL) {
|
||||
var localComic = LocalManager().find(
|
||||
history[index].id,
|
||||
history[index].type,
|
||||
);
|
||||
if (localComic != null) {
|
||||
imageProvider = FileImage(localComic.coverFile);
|
||||
}
|
||||
}
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
context.to(
|
||||
@@ -302,7 +288,7 @@ class _HistoryState extends State<_History> {
|
||||
),
|
||||
clipBehavior: Clip.antiAlias,
|
||||
child: AnimatedImage(
|
||||
image: imageProvider,
|
||||
image: HistoryImageProvider(history[index]),
|
||||
width: 96,
|
||||
height: 128,
|
||||
fit: BoxFit.cover,
|
||||
|
Reference in New Issue
Block a user