fix local comic display

This commit is contained in:
nyne
2024-10-27 18:39:33 +08:00
parent 27d25db407
commit f17af25e2c
16 changed files with 123 additions and 24 deletions

View File

@@ -4,6 +4,8 @@ import 'package:venera/foundation/app.dart';
import 'package:venera/foundation/comic_source/comic_source.dart';
import 'package:venera/foundation/comic_type.dart';
import 'package:venera/foundation/history.dart';
import 'package:venera/foundation/local.dart';
import 'package:venera/utils/ext.dart';
import 'package:venera/utils/translations.dart';
class HistoryPage extends StatefulWidget {
@@ -78,9 +80,19 @@ 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,
e.cover,
cover,
e.id,
e.subtitle,
null,
@@ -100,7 +112,7 @@ class _HistoryPageState extends State<HistoryPage> {
icon: Icons.remove,
text: 'Remove'.tl,
onClick: () {
if(c.sourceKey.startsWith("Invalid")) {
if (c.sourceKey.startsWith("Invalid")) {
HistoryManager().remove(
c.id,
ComicType(int.parse(c.sourceKey.split(':')[1])),