add loginWithWebview, mixed explore page, app links, html node api;

improve ui
This commit is contained in:
nyne
2024-10-17 12:27:20 +08:00
parent d01d0b5ddb
commit 6c8a7d62a6
28 changed files with 686 additions and 199 deletions

View File

@@ -197,6 +197,8 @@ class ComicSource {
final HandleClickTagEvent? handleClickTagEvent;
final LinkHandler? linkHandler;
Future<void> loadData() async {
var file = File("${App.dataPath}/comic_source/$key.data");
if (await file.exists()) {
@@ -261,14 +263,13 @@ class ComicSource {
this.idMatcher,
this.translations,
this.handleClickTagEvent,
this.linkHandler,
);
}
class AccountConfig {
final LoginFunction? login;
final FutureOr<void> Function(BuildContext)? onLogin;
final String? loginWebsite;
final String? registerWebsite;
@@ -279,10 +280,15 @@ class AccountConfig {
final List<AccountInfoItem> infoItems;
final bool Function(String url, String title)? checkLoginStatus;
const AccountConfig(
this.login, this.loginWebsite, this.registerWebsite, this.logout,
{this.onLogin})
: allowReLogin = true,
this.login,
this.loginWebsite,
this.registerWebsite,
this.logout,
this.checkLoginStatus,
) : allowReLogin = true,
infoItems = const [];
}
@@ -315,11 +321,13 @@ class ExplorePageData {
/// return a `List` contains `List<Comic>` or `ExplorePagePart`
final Future<Res<List<Object>>> Function(int index)? loadMixed;
final WidgetBuilder? overridePageBuilder;
ExplorePageData(this.title, this.type, this.loadPage, this.loadMultiPart)
: loadMixed = null,
overridePageBuilder = null;
ExplorePageData(
this.title,
this.type,
this.loadPage,
this.loadMultiPart,
this.loadMixed,
);
}
class ExplorePagePart {
@@ -422,3 +430,12 @@ class CategoryComicsOptions {
const CategoryComicsOptions(this.options, this.notShowWhen, this.showWhen);
}
class LinkHandler {
final List<String> domains;
final String? Function(String url) linkToId;
const LinkHandler(this.domains, this.linkToId);
}