mirror of
https://github.com/venera-app/venera.git
synced 2025-09-27 15:57:25 +00:00
fix #98
This commit is contained in:
@@ -251,7 +251,11 @@
|
||||
"Aggregated Search": "聚合搜索",
|
||||
"No search results found": "未找到搜索结果",
|
||||
"Added @c comics to download queue." : "已添加 @c 本漫画到下载队列",
|
||||
"Download started": "下载已开始"
|
||||
"Download started": "下载已开始",
|
||||
"Click favorite": "点击收藏",
|
||||
"End": "末尾",
|
||||
"None": "无",
|
||||
"View Detail": "查看详情"
|
||||
},
|
||||
"zh_TW": {
|
||||
"Home": "首頁",
|
||||
@@ -505,6 +509,10 @@
|
||||
"Aggregated Search": "聚合搜索",
|
||||
"No search results found": "未找到搜索結果",
|
||||
"Added @c comics to download queue." : "已添加 @c 本漫畫到下載隊列",
|
||||
"Download started": "下載已開始"
|
||||
"Download started": "下載已開始",
|
||||
"Click favorite": "點擊收藏",
|
||||
"End": "末尾",
|
||||
"None": "無",
|
||||
"View Detail": "查看詳情"
|
||||
}
|
||||
}
|
@@ -122,6 +122,7 @@ class _Settings with ChangeNotifier {
|
||||
'enableClockAndBatteryInfoInReader': true,
|
||||
'ignoreCertificateErrors': false,
|
||||
'authorizationRequired': false,
|
||||
'onClickFavorite': 'viewDetail', // viewDetail, read
|
||||
};
|
||||
|
||||
operator [](String key) {
|
||||
|
@@ -28,4 +28,12 @@ class ComicType {
|
||||
}
|
||||
|
||||
static const local = ComicType(0);
|
||||
|
||||
factory ComicType.fromKey(String key) {
|
||||
if(key == "local") {
|
||||
return local;
|
||||
} else {
|
||||
return ComicType(key.hashCode);
|
||||
}
|
||||
}
|
||||
}
|
@@ -14,6 +14,7 @@ import 'package:venera/foundation/local.dart';
|
||||
import 'package:venera/foundation/res.dart';
|
||||
import 'package:venera/network/download.dart';
|
||||
import 'package:venera/pages/comic_page.dart';
|
||||
import 'package:venera/pages/reader/reader.dart';
|
||||
import 'package:venera/utils/io.dart';
|
||||
import 'package:venera/utils/translations.dart';
|
||||
|
||||
|
@@ -389,22 +389,29 @@ class _LocalFavoritesPageState extends State<_LocalFavoritesPage> {
|
||||
),
|
||||
];
|
||||
},
|
||||
onTap: multiSelectMode
|
||||
? (c) {
|
||||
setState(() {
|
||||
if (selectedComics.containsKey(c as FavoriteItem)) {
|
||||
selectedComics.remove(c);
|
||||
_checkExitSelectMode();
|
||||
} else {
|
||||
selectedComics[c] = true;
|
||||
}
|
||||
lastSelectedIndex = comics.indexOf(c);
|
||||
});
|
||||
onTap: (c) {
|
||||
if (multiSelectMode) {
|
||||
setState(() {
|
||||
if (selectedComics.containsKey(c as FavoriteItem)) {
|
||||
selectedComics.remove(c);
|
||||
_checkExitSelectMode();
|
||||
} else {
|
||||
selectedComics[c] = true;
|
||||
}
|
||||
: (c) {
|
||||
App.mainNavigatorKey?.currentContext
|
||||
?.to(() => ComicPage(id: c.id, sourceKey: c.sourceKey));
|
||||
},
|
||||
lastSelectedIndex = comics.indexOf(c);
|
||||
});
|
||||
} else if (appdata.settings["onClickFavorite"] == "viewDetail") {
|
||||
App.mainNavigatorKey?.currentContext
|
||||
?.to(() => ComicPage(id: c.id, sourceKey: c.sourceKey));
|
||||
} else {
|
||||
App.mainNavigatorKey?.currentContext?.to(
|
||||
() => ReaderWithLoading(
|
||||
id: c.id,
|
||||
sourceKey: c.sourceKey,
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
onLongPressed: (c) {
|
||||
setState(() {
|
||||
if (!multiSelectMode) {
|
||||
|
101
lib/pages/reader/loading.dart
Normal file
101
lib/pages/reader/loading.dart
Normal file
@@ -0,0 +1,101 @@
|
||||
part of 'reader.dart';
|
||||
|
||||
class ReaderWithLoading extends StatefulWidget {
|
||||
const ReaderWithLoading({
|
||||
super.key,
|
||||
required this.id,
|
||||
required this.sourceKey,
|
||||
});
|
||||
|
||||
final String id;
|
||||
|
||||
final String sourceKey;
|
||||
|
||||
@override
|
||||
State<ReaderWithLoading> createState() => _ReaderWithLoadingState();
|
||||
}
|
||||
|
||||
class _ReaderWithLoadingState
|
||||
extends LoadingState<ReaderWithLoading, ReaderProps> {
|
||||
@override
|
||||
Widget buildContent(BuildContext context, ReaderProps data) {
|
||||
return Reader(
|
||||
type: data.type,
|
||||
cid: data.cid,
|
||||
name: data.name,
|
||||
chapters: data.chapters,
|
||||
history: data.history,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Res<ReaderProps>> loadData() async {
|
||||
var comicSource = ComicSource.find(widget.sourceKey);
|
||||
var history = HistoryManager().findSync(
|
||||
widget.id,
|
||||
ComicType.fromKey(widget.sourceKey),
|
||||
);
|
||||
if (comicSource == null) {
|
||||
var localComic = LocalManager().find(
|
||||
widget.id,
|
||||
ComicType.fromKey(widget.sourceKey),
|
||||
);
|
||||
if (localComic == null) {
|
||||
return Res.error("comic not found");
|
||||
}
|
||||
return Res(
|
||||
ReaderProps(
|
||||
type: ComicType.fromKey(widget.sourceKey),
|
||||
cid: widget.id,
|
||||
name: localComic.title,
|
||||
chapters: localComic.chapters,
|
||||
history: history ??
|
||||
History.fromModel(
|
||||
model: localComic,
|
||||
ep: 0,
|
||||
page: 0,
|
||||
),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
var comic = await comicSource.loadComicInfo!(widget.id);
|
||||
if (comic.error) {
|
||||
return Res.fromErrorRes(comic);
|
||||
}
|
||||
return Res(
|
||||
ReaderProps(
|
||||
type: ComicType.fromKey(widget.sourceKey),
|
||||
cid: widget.id,
|
||||
name: comic.data.title,
|
||||
chapters: comic.data.chapters,
|
||||
history: history ??
|
||||
History.fromModel(
|
||||
model: comic.data,
|
||||
ep: 0,
|
||||
page: 0,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class ReaderProps {
|
||||
final ComicType type;
|
||||
|
||||
final String cid;
|
||||
|
||||
final String name;
|
||||
|
||||
final Map<String, String>? chapters;
|
||||
|
||||
final History history;
|
||||
|
||||
const ReaderProps({
|
||||
required this.type,
|
||||
required this.cid,
|
||||
required this.name,
|
||||
required this.chapters,
|
||||
required this.history,
|
||||
});
|
||||
}
|
@@ -18,11 +18,13 @@ import 'package:venera/components/custom_slider.dart';
|
||||
import 'package:venera/foundation/app.dart';
|
||||
import 'package:venera/foundation/appdata.dart';
|
||||
import 'package:venera/foundation/cache_manager.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/image_provider/reader_image.dart';
|
||||
import 'package:venera/foundation/local.dart';
|
||||
import 'package:venera/foundation/log.dart';
|
||||
import 'package:venera/foundation/res.dart';
|
||||
import 'package:venera/pages/settings/settings_page.dart';
|
||||
import 'package:venera/utils/data_sync.dart';
|
||||
import 'package:venera/utils/file_type.dart';
|
||||
@@ -36,6 +38,7 @@ part 'scaffold.dart';
|
||||
part 'images.dart';
|
||||
part 'gesture.dart';
|
||||
part 'comic_image.dart';
|
||||
part 'loading.dart';
|
||||
|
||||
extension _ReaderContext on BuildContext {
|
||||
_ReaderState get reader => findAncestorStateOfType<_ReaderState>()!;
|
||||
|
@@ -16,18 +16,18 @@ class _LocalFavoritesSettingsState extends State<LocalFavoritesSettings> {
|
||||
SelectSetting(
|
||||
title: "Add new favorite to".tl,
|
||||
settingKey: "newFavoriteAddTo",
|
||||
optionTranslation: const {
|
||||
"start": "Start",
|
||||
"end": "End",
|
||||
optionTranslation: {
|
||||
"start": "Start".tl,
|
||||
"end": "End".tl,
|
||||
},
|
||||
).toSliver(),
|
||||
SelectSetting(
|
||||
title: "Move favorite after reading".tl,
|
||||
settingKey: "moveFavoriteAfterRead",
|
||||
optionTranslation: const {
|
||||
"none": "None",
|
||||
"end": "End",
|
||||
"start": "Start",
|
||||
optionTranslation: {
|
||||
"none": "None".tl,
|
||||
"end": "End".tl,
|
||||
"start": "Start".tl,
|
||||
},
|
||||
).toSliver(),
|
||||
SelectSetting(
|
||||
@@ -48,6 +48,14 @@ class _LocalFavoritesSettingsState extends State<LocalFavoritesSettings> {
|
||||
},
|
||||
actionTitle: 'Delete'.tl,
|
||||
).toSliver(),
|
||||
SelectSetting(
|
||||
title: "Click favorite".tl,
|
||||
settingKey: "onClickFavorite",
|
||||
optionTranslation: {
|
||||
"viewDetail": "View Detail".tl,
|
||||
"read": "Read".tl,
|
||||
},
|
||||
).toSliver(),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
20
pubspec.lock
20
pubspec.lock
@@ -446,11 +446,10 @@ packages:
|
||||
flutter_to_arch:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
path: "."
|
||||
ref: HEAD
|
||||
resolved-ref: "15bfead0380fda79b0256b37c73b886b0882f1bf"
|
||||
url: "https://github.com/wgh136/flutter_to_arch"
|
||||
source: git
|
||||
name: flutter_to_arch
|
||||
sha256: "656cffc182b05af38aa96a1115931620b8865c4b0cfe00813b26fcff0875f2ab"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.0"
|
||||
flutter_to_debian:
|
||||
dependency: "direct dev"
|
||||
@@ -1125,12 +1124,11 @@ packages:
|
||||
zip_flutter:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
path: "."
|
||||
ref: "51007a0"
|
||||
resolved-ref: "51007a0c1f34ee7865ef3bdededf40e5f5df85bd"
|
||||
url: "https://github.com/wgh136/zip_flutter"
|
||||
source: git
|
||||
version: "0.0.3"
|
||||
name: zip_flutter
|
||||
sha256: "78c9b6053117828581346d24b07943ba6d3032a13f68d15c133bc21df2cf178a"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.0.4"
|
||||
sdks:
|
||||
dart: ">=3.6.0 <4.0.0"
|
||||
flutter: ">=3.27.1"
|
||||
|
@@ -51,10 +51,7 @@ dependencies:
|
||||
sliver_tools: ^0.2.12
|
||||
flutter_file_dialog: ^3.0.2
|
||||
file_selector: ^1.0.3
|
||||
zip_flutter:
|
||||
git:
|
||||
url: https://github.com/wgh136/zip_flutter
|
||||
ref: 51007a0
|
||||
zip_flutter: ^0.0.4
|
||||
lodepng_flutter:
|
||||
git:
|
||||
url: https://github.com/venera-app/lodepng_flutter
|
||||
@@ -79,8 +76,7 @@ dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
flutter_lints: ^5.0.0
|
||||
flutter_to_arch:
|
||||
git: https://github.com/wgh136/flutter_to_arch
|
||||
flutter_to_arch: ^1.0.0
|
||||
flutter_to_debian:
|
||||
|
||||
flutter:
|
||||
|
Reference in New Issue
Block a user