mirror of
https://github.com/kodjodevf/mangayomi.git
synced 2026-04-21 16:01:58 +00:00
parent
fd00d70994
commit
a3a3417efd
2 changed files with 45 additions and 51 deletions
|
|
@ -1,6 +1,3 @@
|
||||||
import 'dart:convert';
|
|
||||||
import 'dart:io';
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:mangayomi/modules/more/widgets/list_tile_widget.dart';
|
import 'package:mangayomi/modules/more/widgets/list_tile_widget.dart';
|
||||||
|
|
@ -29,20 +26,6 @@ class SettingsScreen extends StatelessWidget {
|
||||||
subtitle: l10n.appearance_subtitle,
|
subtitle: l10n.appearance_subtitle,
|
||||||
icon: Icons.color_lens_rounded,
|
icon: Icons.color_lens_rounded,
|
||||||
onTap: () => context.push('/appearance')),
|
onTap: () => context.push('/appearance')),
|
||||||
ListTileWidget(
|
|
||||||
title: l10n.library,
|
|
||||||
subtitle: 'Categories',
|
|
||||||
icon: Icons.collections_bookmark_rounded,
|
|
||||||
onTap: () async {
|
|
||||||
final process = await Process.start(
|
|
||||||
"C:/DEV/flutter/mangayomi/server/TorrServer.exe",
|
|
||||||
[],
|
|
||||||
workingDirectory: "C:/DEV/flutter/mangayomi/server",
|
|
||||||
);
|
|
||||||
await process.stderr.forEach((e) {
|
|
||||||
print(utf8.decode(e));
|
|
||||||
});
|
|
||||||
}),
|
|
||||||
ListTileWidget(
|
ListTileWidget(
|
||||||
title: l10n.reader,
|
title: l10n.reader,
|
||||||
subtitle: l10n.reader_subtitle,
|
subtitle: l10n.reader_subtitle,
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:bot_toast/bot_toast.dart';
|
import 'package:bot_toast/bot_toast.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
|
|
@ -33,6 +35,7 @@ import 'package:mangayomi/modules/more/settings/general/general_screen.dart';
|
||||||
import 'package:mangayomi/modules/more/settings/reader/reader_screen.dart';
|
import 'package:mangayomi/modules/more/settings/reader/reader_screen.dart';
|
||||||
import 'package:mangayomi/modules/more/settings/settings_screen.dart';
|
import 'package:mangayomi/modules/more/settings/settings_screen.dart';
|
||||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
part 'router.g.dart';
|
part 'router.g.dart';
|
||||||
|
|
||||||
@riverpod
|
@riverpod
|
||||||
|
|
@ -80,7 +83,7 @@ class RouterNotifier extends ChangeNotifier {
|
||||||
builder: (context, state) => const LibraryScreen(
|
builder: (context, state) => const LibraryScreen(
|
||||||
isManga: true,
|
isManga: true,
|
||||||
),
|
),
|
||||||
pageBuilder: (context, state) => CustomTransition(
|
pageBuilder: (context, state) => transitionPage(
|
||||||
key: state.pageKey,
|
key: state.pageKey,
|
||||||
child: const LibraryScreen(
|
child: const LibraryScreen(
|
||||||
isManga: true,
|
isManga: true,
|
||||||
|
|
@ -93,7 +96,7 @@ class RouterNotifier extends ChangeNotifier {
|
||||||
builder: (context, state) => const LibraryScreen(
|
builder: (context, state) => const LibraryScreen(
|
||||||
isManga: false,
|
isManga: false,
|
||||||
),
|
),
|
||||||
pageBuilder: (context, state) => CustomTransition(
|
pageBuilder: (context, state) => transitionPage(
|
||||||
key: state.pageKey,
|
key: state.pageKey,
|
||||||
child: const LibraryScreen(
|
child: const LibraryScreen(
|
||||||
isManga: false,
|
isManga: false,
|
||||||
|
|
@ -104,7 +107,7 @@ class RouterNotifier extends ChangeNotifier {
|
||||||
name: "history",
|
name: "history",
|
||||||
path: '/history',
|
path: '/history',
|
||||||
builder: (context, state) => const HistoryScreen(),
|
builder: (context, state) => const HistoryScreen(),
|
||||||
pageBuilder: (context, state) => CustomTransition(
|
pageBuilder: (context, state) => transitionPage(
|
||||||
key: state.pageKey,
|
key: state.pageKey,
|
||||||
child: const HistoryScreen(),
|
child: const HistoryScreen(),
|
||||||
),
|
),
|
||||||
|
|
@ -113,7 +116,7 @@ class RouterNotifier extends ChangeNotifier {
|
||||||
name: "browse",
|
name: "browse",
|
||||||
path: '/browse',
|
path: '/browse',
|
||||||
builder: (context, state) => const BrowseScreen(),
|
builder: (context, state) => const BrowseScreen(),
|
||||||
pageBuilder: (context, state) => CustomTransition(
|
pageBuilder: (context, state) => transitionPage(
|
||||||
key: state.pageKey,
|
key: state.pageKey,
|
||||||
child: const BrowseScreen(),
|
child: const BrowseScreen(),
|
||||||
),
|
),
|
||||||
|
|
@ -122,7 +125,7 @@ class RouterNotifier extends ChangeNotifier {
|
||||||
name: "more",
|
name: "more",
|
||||||
path: '/more',
|
path: '/more',
|
||||||
builder: (context, state) => const MoreScreen(),
|
builder: (context, state) => const MoreScreen(),
|
||||||
pageBuilder: (context, state) => CustomTransition(
|
pageBuilder: (context, state) => transitionPage(
|
||||||
key: state.pageKey,
|
key: state.pageKey,
|
||||||
child: const MoreScreen(),
|
child: const MoreScreen(),
|
||||||
),
|
),
|
||||||
|
|
@ -132,7 +135,7 @@ class RouterNotifier extends ChangeNotifier {
|
||||||
name: "updates",
|
name: "updates",
|
||||||
path: '/updates',
|
path: '/updates',
|
||||||
builder: (context, state) => const UpdatesScreen(),
|
builder: (context, state) => const UpdatesScreen(),
|
||||||
pageBuilder: (context, state) => CustomTransition(
|
pageBuilder: (context, state) => transitionPage(
|
||||||
key: state.pageKey,
|
key: state.pageKey,
|
||||||
child: const UpdatesScreen(),
|
child: const UpdatesScreen(),
|
||||||
),
|
),
|
||||||
|
|
@ -148,7 +151,7 @@ class RouterNotifier extends ChangeNotifier {
|
||||||
},
|
},
|
||||||
pageBuilder: (context, state) {
|
pageBuilder: (context, state) {
|
||||||
final source = state.extra as Source?;
|
final source = state.extra as Source?;
|
||||||
return CustomTransition(
|
return transitionPage(
|
||||||
key: state.pageKey,
|
key: state.pageKey,
|
||||||
child: MangaHomeScreen(
|
child: MangaHomeScreen(
|
||||||
source: source!,
|
source: source!,
|
||||||
|
|
@ -167,7 +170,7 @@ class RouterNotifier extends ChangeNotifier {
|
||||||
pageBuilder: (context, state) {
|
pageBuilder: (context, state) {
|
||||||
int mangaId = state.extra as int;
|
int mangaId = state.extra as int;
|
||||||
|
|
||||||
return CustomTransition(
|
return transitionPage(
|
||||||
key: state.pageKey,
|
key: state.pageKey,
|
||||||
child: MangaReaderDetail(
|
child: MangaReaderDetail(
|
||||||
mangaId: mangaId,
|
mangaId: mangaId,
|
||||||
|
|
@ -184,7 +187,7 @@ class RouterNotifier extends ChangeNotifier {
|
||||||
},
|
},
|
||||||
pageBuilder: (context, state) {
|
pageBuilder: (context, state) {
|
||||||
final chapter = state.extra as Chapter;
|
final chapter = state.extra as Chapter;
|
||||||
return CustomTransition(
|
return transitionPage(
|
||||||
key: state.pageKey,
|
key: state.pageKey,
|
||||||
child: MangaReaderView(
|
child: MangaReaderView(
|
||||||
chapter: chapter,
|
chapter: chapter,
|
||||||
|
|
@ -203,7 +206,7 @@ class RouterNotifier extends ChangeNotifier {
|
||||||
},
|
},
|
||||||
pageBuilder: (context, state) {
|
pageBuilder: (context, state) {
|
||||||
final episode = state.extra as Chapter;
|
final episode = state.extra as Chapter;
|
||||||
return CustomTransition(
|
return transitionPage(
|
||||||
key: state.pageKey,
|
key: state.pageKey,
|
||||||
child: AnimePlayerView(
|
child: AnimePlayerView(
|
||||||
episode: episode,
|
episode: episode,
|
||||||
|
|
@ -222,7 +225,7 @@ class RouterNotifier extends ChangeNotifier {
|
||||||
},
|
},
|
||||||
pageBuilder: (context, state) {
|
pageBuilder: (context, state) {
|
||||||
final isManga = state.extra as bool;
|
final isManga = state.extra as bool;
|
||||||
return CustomTransition(
|
return transitionPage(
|
||||||
key: state.pageKey,
|
key: state.pageKey,
|
||||||
child: ExtensionsLang(
|
child: ExtensionsLang(
|
||||||
isManga: isManga,
|
isManga: isManga,
|
||||||
|
|
@ -237,7 +240,7 @@ class RouterNotifier extends ChangeNotifier {
|
||||||
return const SettingsScreen();
|
return const SettingsScreen();
|
||||||
},
|
},
|
||||||
pageBuilder: (context, state) {
|
pageBuilder: (context, state) {
|
||||||
return CustomTransition(
|
return transitionPage(
|
||||||
key: state.pageKey,
|
key: state.pageKey,
|
||||||
child: const SettingsScreen(),
|
child: const SettingsScreen(),
|
||||||
);
|
);
|
||||||
|
|
@ -250,7 +253,7 @@ class RouterNotifier extends ChangeNotifier {
|
||||||
return const AppearanceScreen();
|
return const AppearanceScreen();
|
||||||
},
|
},
|
||||||
pageBuilder: (context, state) {
|
pageBuilder: (context, state) {
|
||||||
return CustomTransition(
|
return transitionPage(
|
||||||
key: state.pageKey,
|
key: state.pageKey,
|
||||||
child: const AppearanceScreen(),
|
child: const AppearanceScreen(),
|
||||||
);
|
);
|
||||||
|
|
@ -267,7 +270,7 @@ class RouterNotifier extends ChangeNotifier {
|
||||||
},
|
},
|
||||||
pageBuilder: (context, state) {
|
pageBuilder: (context, state) {
|
||||||
final source = state.extra as Source;
|
final source = state.extra as Source;
|
||||||
return CustomTransition(
|
return transitionPage(
|
||||||
key: state.pageKey,
|
key: state.pageKey,
|
||||||
child: ExtensionDetail(
|
child: ExtensionDetail(
|
||||||
source: source,
|
source: source,
|
||||||
|
|
@ -286,7 +289,7 @@ class RouterNotifier extends ChangeNotifier {
|
||||||
},
|
},
|
||||||
pageBuilder: (context, state) {
|
pageBuilder: (context, state) {
|
||||||
final isManga = state.extra as bool;
|
final isManga = state.extra as bool;
|
||||||
return CustomTransition(
|
return transitionPage(
|
||||||
key: state.pageKey,
|
key: state.pageKey,
|
||||||
child: GlobalSearchScreen(
|
child: GlobalSearchScreen(
|
||||||
isManga: isManga,
|
isManga: isManga,
|
||||||
|
|
@ -301,7 +304,7 @@ class RouterNotifier extends ChangeNotifier {
|
||||||
return const AboutScreen();
|
return const AboutScreen();
|
||||||
},
|
},
|
||||||
pageBuilder: (context, state) {
|
pageBuilder: (context, state) {
|
||||||
return CustomTransition(
|
return transitionPage(
|
||||||
key: state.pageKey,
|
key: state.pageKey,
|
||||||
child: const AboutScreen(),
|
child: const AboutScreen(),
|
||||||
);
|
);
|
||||||
|
|
@ -314,7 +317,7 @@ class RouterNotifier extends ChangeNotifier {
|
||||||
return const TrackScreen();
|
return const TrackScreen();
|
||||||
},
|
},
|
||||||
pageBuilder: (context, state) {
|
pageBuilder: (context, state) {
|
||||||
return CustomTransition(
|
return transitionPage(
|
||||||
key: state.pageKey,
|
key: state.pageKey,
|
||||||
child: const TrackScreen(),
|
child: const TrackScreen(),
|
||||||
);
|
);
|
||||||
|
|
@ -331,7 +334,7 @@ class RouterNotifier extends ChangeNotifier {
|
||||||
},
|
},
|
||||||
pageBuilder: (context, state) {
|
pageBuilder: (context, state) {
|
||||||
final isManga = state.extra as bool;
|
final isManga = state.extra as bool;
|
||||||
return CustomTransition(
|
return transitionPage(
|
||||||
key: state.pageKey,
|
key: state.pageKey,
|
||||||
child: SourcesFilterScreen(
|
child: SourcesFilterScreen(
|
||||||
isManga: isManga,
|
isManga: isManga,
|
||||||
|
|
@ -346,7 +349,7 @@ class RouterNotifier extends ChangeNotifier {
|
||||||
return const DownloadQueueScreen();
|
return const DownloadQueueScreen();
|
||||||
},
|
},
|
||||||
pageBuilder: (context, state) {
|
pageBuilder: (context, state) {
|
||||||
return CustomTransition(
|
return transitionPage(
|
||||||
key: state.pageKey,
|
key: state.pageKey,
|
||||||
child: const DownloadQueueScreen(),
|
child: const DownloadQueueScreen(),
|
||||||
);
|
);
|
||||||
|
|
@ -364,7 +367,7 @@ class RouterNotifier extends ChangeNotifier {
|
||||||
},
|
},
|
||||||
pageBuilder: (context, state) {
|
pageBuilder: (context, state) {
|
||||||
final data = state.extra as Map<String, String>;
|
final data = state.extra as Map<String, String>;
|
||||||
return CustomTransition(
|
return transitionPage(
|
||||||
key: state.pageKey,
|
key: state.pageKey,
|
||||||
child: MangaWebView(
|
child: MangaWebView(
|
||||||
url: data["url"]!,
|
url: data["url"]!,
|
||||||
|
|
@ -383,7 +386,7 @@ class RouterNotifier extends ChangeNotifier {
|
||||||
},
|
},
|
||||||
pageBuilder: (context, state) {
|
pageBuilder: (context, state) {
|
||||||
final data = state.extra as (bool, int);
|
final data = state.extra as (bool, int);
|
||||||
return CustomTransition(
|
return transitionPage(
|
||||||
key: state.pageKey,
|
key: state.pageKey,
|
||||||
child: CategoriesScreen(
|
child: CategoriesScreen(
|
||||||
data: data,
|
data: data,
|
||||||
|
|
@ -398,7 +401,7 @@ class RouterNotifier extends ChangeNotifier {
|
||||||
return const GeneralScreen();
|
return const GeneralScreen();
|
||||||
},
|
},
|
||||||
pageBuilder: (context, state) {
|
pageBuilder: (context, state) {
|
||||||
return CustomTransition(
|
return transitionPage(
|
||||||
key: state.pageKey,
|
key: state.pageKey,
|
||||||
child: const GeneralScreen(),
|
child: const GeneralScreen(),
|
||||||
);
|
);
|
||||||
|
|
@ -411,7 +414,7 @@ class RouterNotifier extends ChangeNotifier {
|
||||||
return const ReaderScreen();
|
return const ReaderScreen();
|
||||||
},
|
},
|
||||||
pageBuilder: (context, state) {
|
pageBuilder: (context, state) {
|
||||||
return CustomTransition(
|
return transitionPage(
|
||||||
key: state.pageKey,
|
key: state.pageKey,
|
||||||
child: const ReaderScreen(),
|
child: const ReaderScreen(),
|
||||||
);
|
);
|
||||||
|
|
@ -424,7 +427,7 @@ class RouterNotifier extends ChangeNotifier {
|
||||||
return const BrowseSScreen();
|
return const BrowseSScreen();
|
||||||
},
|
},
|
||||||
pageBuilder: (context, state) {
|
pageBuilder: (context, state) {
|
||||||
return CustomTransition(
|
return transitionPage(
|
||||||
key: state.pageKey,
|
key: state.pageKey,
|
||||||
child: const BrowseSScreen(),
|
child: const BrowseSScreen(),
|
||||||
);
|
);
|
||||||
|
|
@ -437,7 +440,7 @@ class RouterNotifier extends ChangeNotifier {
|
||||||
return const DownloadsScreen();
|
return const DownloadsScreen();
|
||||||
},
|
},
|
||||||
pageBuilder: (context, state) {
|
pageBuilder: (context, state) {
|
||||||
return CustomTransition(
|
return transitionPage(
|
||||||
key: state.pageKey,
|
key: state.pageKey,
|
||||||
child: const DownloadsScreen(),
|
child: const DownloadsScreen(),
|
||||||
);
|
);
|
||||||
|
|
@ -450,7 +453,7 @@ class RouterNotifier extends ChangeNotifier {
|
||||||
return const BackupAndRestore();
|
return const BackupAndRestore();
|
||||||
},
|
},
|
||||||
pageBuilder: (context, state) {
|
pageBuilder: (context, state) {
|
||||||
return CustomTransition(
|
return transitionPage(
|
||||||
key: state.pageKey,
|
key: state.pageKey,
|
||||||
child: const BackupAndRestore(),
|
child: const BackupAndRestore(),
|
||||||
);
|
);
|
||||||
|
|
@ -463,7 +466,7 @@ class RouterNotifier extends ChangeNotifier {
|
||||||
return const ManageTrackersScreen();
|
return const ManageTrackersScreen();
|
||||||
},
|
},
|
||||||
pageBuilder: (context, state) {
|
pageBuilder: (context, state) {
|
||||||
return CustomTransition(
|
return transitionPage(
|
||||||
key: state.pageKey,
|
key: state.pageKey,
|
||||||
child: const ManageTrackersScreen(),
|
child: const ManageTrackersScreen(),
|
||||||
);
|
);
|
||||||
|
|
@ -478,7 +481,7 @@ class RouterNotifier extends ChangeNotifier {
|
||||||
},
|
},
|
||||||
pageBuilder: (context, state) {
|
pageBuilder: (context, state) {
|
||||||
final trackerPref = state.extra as TrackPreference;
|
final trackerPref = state.extra as TrackPreference;
|
||||||
return CustomTransition(
|
return transitionPage(
|
||||||
key: state.pageKey,
|
key: state.pageKey,
|
||||||
child: TrackingDetail(trackerPref: trackerPref),
|
child: TrackingDetail(trackerPref: trackerPref),
|
||||||
);
|
);
|
||||||
|
|
@ -487,6 +490,12 @@ class RouterNotifier extends ChangeNotifier {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dynamic transitionPage({required LocalKey key, required child}) {
|
||||||
|
return Platform.isIOS
|
||||||
|
? CupertinoPage(key: key, child: child)
|
||||||
|
: CustomTransition(child: child, key: key);
|
||||||
|
}
|
||||||
|
|
||||||
class CustomTransition extends CustomTransitionPage {
|
class CustomTransition extends CustomTransitionPage {
|
||||||
CustomTransition({required LocalKey super.key, required super.child})
|
CustomTransition({required LocalKey super.key, required super.child})
|
||||||
: super(
|
: super(
|
||||||
|
|
@ -497,10 +506,12 @@ class CustomTransition extends CustomTransitionPage {
|
||||||
}
|
}
|
||||||
|
|
||||||
Route createRoute({required Widget page}) {
|
Route createRoute({required Widget page}) {
|
||||||
return PageRouteBuilder(
|
return Platform.isIOS
|
||||||
pageBuilder: (context, animation, secondaryAnimation) => page,
|
? CupertinoPageRoute(builder: (context) => page)
|
||||||
transitionsBuilder: (context, animation, secondaryAnimation, child) {
|
: PageRouteBuilder(
|
||||||
return FadeTransition(opacity: animation, child: child);
|
pageBuilder: (context, animation, secondaryAnimation) => page,
|
||||||
},
|
transitionsBuilder: (context, animation, secondaryAnimation, child) {
|
||||||
);
|
return FadeTransition(opacity: animation, child: child);
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue