get back history page to main view
This commit is contained in:
parent
7b94186732
commit
5648359c46
6 changed files with 64 additions and 74 deletions
|
|
@ -1,5 +1,4 @@
|
|||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
|
@ -27,17 +26,15 @@ class MainScreen extends ConsumerWidget {
|
|||
routerCurrentLocationStateProvider(context),
|
||||
);
|
||||
bool isReadingScreen = location == '/mangareaderview';
|
||||
int currentIndex = location == null
|
||||
? 0
|
||||
: location == '/MangaLibrary'
|
||||
? 0
|
||||
: location == '/AnimeLibrary'
|
||||
? 1
|
||||
: location == '/updates'
|
||||
? 2
|
||||
: location == '/browse'
|
||||
? 3
|
||||
: 4;
|
||||
int currentIndex = switch (location) {
|
||||
null => 0,
|
||||
'/MangaLibrary' => 0,
|
||||
'/AnimeLibrary' => 1,
|
||||
'/history' => 2,
|
||||
'/browse' => 3,
|
||||
_ => 4,
|
||||
};
|
||||
|
||||
final incognitoMode = ref.watch(incognitoModeStateProvider);
|
||||
final isLongPressed = ref.watch(isLongPressedMangaStateProvider);
|
||||
return Column(
|
||||
|
|
@ -84,7 +81,7 @@ class MainScreen extends ConsumerWidget {
|
|||
? 100
|
||||
: location != '/MangaLibrary' &&
|
||||
location != '/AnimeLibrary' &&
|
||||
location != '/updates' &&
|
||||
location != '/history' &&
|
||||
location != '/browse' &&
|
||||
location != '/more'
|
||||
? 0
|
||||
|
|
@ -128,13 +125,13 @@ class MainScreen extends ConsumerWidget {
|
|||
),
|
||||
label: Padding(
|
||||
padding: const EdgeInsets.only(top: 5),
|
||||
child: Text(l10n.updates))),
|
||||
child: Text(l10n.history))),
|
||||
NavigationRailDestination(
|
||||
selectedIcon: const Icon(
|
||||
Icons.explore,
|
||||
Icons.history,
|
||||
),
|
||||
icon: const Icon(
|
||||
Icons.explore_outlined,
|
||||
Icons.history_outlined,
|
||||
),
|
||||
label: Padding(
|
||||
padding: const EdgeInsets.only(top: 5),
|
||||
|
|
@ -159,7 +156,7 @@ class MainScreen extends ConsumerWidget {
|
|||
} else if (newIndex == 1) {
|
||||
route.go('/AnimeLibrary');
|
||||
} else if (newIndex == 2) {
|
||||
route.go('/updates');
|
||||
route.go('/history');
|
||||
} else if (newIndex == 3) {
|
||||
route.go('/browse');
|
||||
} else if (newIndex == 4) {
|
||||
|
|
@ -184,7 +181,7 @@ class MainScreen extends ConsumerWidget {
|
|||
? 80
|
||||
: location != '/MangaLibrary' &&
|
||||
location != '/AnimeLibrary' &&
|
||||
location != '/updates' &&
|
||||
location != '/history' &&
|
||||
location != '/browse' &&
|
||||
location != '/more'
|
||||
? 0
|
||||
|
|
@ -222,13 +219,13 @@ class MainScreen extends ConsumerWidget {
|
|||
icon: const Icon(
|
||||
Icons.new_releases_outlined,
|
||||
),
|
||||
label: l10n.updates),
|
||||
label: l10n.history),
|
||||
NavigationDestination(
|
||||
selectedIcon: const Icon(
|
||||
Icons.explore,
|
||||
Icons.history,
|
||||
),
|
||||
icon: const Icon(
|
||||
Icons.explore_outlined,
|
||||
Icons.history_outlined,
|
||||
),
|
||||
label: l10n.browse),
|
||||
NavigationDestination(
|
||||
|
|
@ -246,7 +243,7 @@ class MainScreen extends ConsumerWidget {
|
|||
} else if (newIndex == 1) {
|
||||
route.go('/AnimeLibrary');
|
||||
} else if (newIndex == 2) {
|
||||
route.go('/updates');
|
||||
route.go('/history');
|
||||
} else if (newIndex == 3) {
|
||||
route.go('/browse');
|
||||
} else if (newIndex == 4) {
|
||||
|
|
|
|||
|
|
@ -156,6 +156,9 @@ class _MangaChapterPageGalleryState
|
|||
|
||||
@override
|
||||
void dispose() {
|
||||
_readerController.setMangaHistoryUpdate();
|
||||
_readerController
|
||||
.setPageIndex(_uChapDataPreload[_currentIndex ?? 0].index!);
|
||||
_rebuildDetail.close();
|
||||
_doubleClickAnimationController.dispose();
|
||||
clearGestureDetailsCache();
|
||||
|
|
@ -182,8 +185,6 @@ class _MangaChapterPageGalleryState
|
|||
|
||||
late int? _currentIndex = _readerController.getPageIndex();
|
||||
|
||||
T? ambiguate<T>(T? value) => value;
|
||||
|
||||
late ListObserverController _observerController;
|
||||
final ScrollController _scrollController = ScrollController();
|
||||
@override
|
||||
|
|
@ -212,15 +213,15 @@ class _MangaChapterPageGalleryState
|
|||
List<UChapDataPreload> uChapDataPreloadP = [];
|
||||
List<UChapDataPreload> uChapDataPreloadL = _uChapDataPreload;
|
||||
List<UChapDataPreload> preChap = [];
|
||||
for (var ee in _uChapDataPreload) {
|
||||
for (var data in _uChapDataPreload) {
|
||||
if (chapterData.uChapDataPreload.first.chapter!.url ==
|
||||
ee.chapter!.url) {
|
||||
data.chapter!.url) {
|
||||
isExist = true;
|
||||
}
|
||||
}
|
||||
if (!isExist) {
|
||||
for (var aa in chapterData.uChapDataPreload) {
|
||||
preChap.add(aa);
|
||||
for (var data in chapterData.uChapDataPreload) {
|
||||
preChap.add(data);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -229,15 +230,7 @@ class _MangaChapterPageGalleryState
|
|||
for (var i = 0; i < preChap.length; i++) {
|
||||
int index = i + length;
|
||||
final dataPreload = preChap[i];
|
||||
uChapDataPreloadP.add(UChapDataPreload(
|
||||
dataPreload.chapter,
|
||||
dataPreload.path,
|
||||
dataPreload.url,
|
||||
dataPreload.isLocale,
|
||||
dataPreload.archiveImage,
|
||||
dataPreload.index,
|
||||
dataPreload.chapterUrlModel,
|
||||
index));
|
||||
uChapDataPreloadP.add(dataPreload..index = index);
|
||||
}
|
||||
if (mounted) {
|
||||
uChapDataPreloadL.addAll(uChapDataPreloadP);
|
||||
|
|
@ -1419,14 +1412,14 @@ class _MangaChapterPageGalleryState
|
|||
}
|
||||
|
||||
class UChapDataPreload {
|
||||
final Chapter? chapter;
|
||||
final Directory? path;
|
||||
final String? url;
|
||||
final bool? isLocale;
|
||||
final Uint8List? archiveImage;
|
||||
final int? index;
|
||||
final GetChapterUrlModel? chapterUrlModel;
|
||||
final int? pageIndex;
|
||||
Chapter? chapter;
|
||||
Directory? path;
|
||||
String? url;
|
||||
bool? isLocale;
|
||||
Uint8List? archiveImage;
|
||||
int? index;
|
||||
GetChapterUrlModel? chapterUrlModel;
|
||||
int? pageIndex;
|
||||
UChapDataPreload(
|
||||
this.chapter,
|
||||
this.path,
|
||||
|
|
|
|||
|
|
@ -53,13 +53,13 @@ class MoreScreen extends StatelessWidget {
|
|||
title: l10n.categories,
|
||||
),
|
||||
const Divider(),
|
||||
ListTileWidget(
|
||||
onTap: () {
|
||||
context.push('/history');
|
||||
},
|
||||
icon: Icons.history_outlined,
|
||||
title: l10n.history,
|
||||
),
|
||||
// ListTileWidget(
|
||||
// onTap: () {
|
||||
// context.push('/history');
|
||||
// },
|
||||
// icon: Icons.history_outlined,
|
||||
// title: l10n.history,
|
||||
// ),
|
||||
// ListTile(
|
||||
// onTap: () {},
|
||||
// leading: const SizedBox(
|
||||
|
|
|
|||
|
|
@ -96,6 +96,15 @@ class RouterNotifier extends ChangeNotifier {
|
|||
),
|
||||
),
|
||||
),
|
||||
GoRoute(
|
||||
name: "history",
|
||||
path: '/history',
|
||||
builder: (context, state) => const HistoryScreen(),
|
||||
pageBuilder: (context, state) => CustomTransition(
|
||||
key: state.pageKey,
|
||||
child: const HistoryScreen(),
|
||||
),
|
||||
),
|
||||
GoRoute(
|
||||
name: "browse",
|
||||
path: '/browse',
|
||||
|
|
@ -105,15 +114,6 @@ class RouterNotifier extends ChangeNotifier {
|
|||
child: const BrowseScreen(),
|
||||
),
|
||||
),
|
||||
GoRoute(
|
||||
name: "updates",
|
||||
path: '/updates',
|
||||
builder: (context, state) => const UpdatesScreen(),
|
||||
pageBuilder: (context, state) => CustomTransition(
|
||||
key: state.pageKey,
|
||||
child: const UpdatesScreen(),
|
||||
),
|
||||
),
|
||||
GoRoute(
|
||||
name: "more",
|
||||
path: '/more',
|
||||
|
|
@ -125,12 +125,12 @@ class RouterNotifier extends ChangeNotifier {
|
|||
),
|
||||
]),
|
||||
GoRoute(
|
||||
name: "history",
|
||||
path: '/history',
|
||||
builder: (context, state) => const HistoryScreen(),
|
||||
name: "updates",
|
||||
path: '/updates',
|
||||
builder: (context, state) => const UpdatesScreen(),
|
||||
pageBuilder: (context, state) => CustomTransition(
|
||||
key: state.pageKey,
|
||||
child: const HistoryScreen(),
|
||||
child: const UpdatesScreen(),
|
||||
),
|
||||
),
|
||||
GoRoute(
|
||||
|
|
|
|||
12
pubspec.lock
12
pubspec.lock
|
|
@ -527,10 +527,10 @@ packages:
|
|||
dependency: "direct main"
|
||||
description:
|
||||
name: flutter_meedu_videoplayer
|
||||
sha256: "6849b2b05c8413f2efbb70cf5be759b2e6a978e373e58c8d8bb87414ba141e6c"
|
||||
sha256: "5d687cca1681041b1ca078de3abd677b4e97d9a5b141009963927c43438b7ad9"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.2.21"
|
||||
version: "4.2.22"
|
||||
flutter_plugin_android_lifecycle:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -857,10 +857,10 @@ packages:
|
|||
dependency: "direct main"
|
||||
description:
|
||||
name: media_kit_libs_ios_video
|
||||
sha256: c691220334c1828e1fd24db4ebbdfdd6c576f0345bc6cc435b355798d6e4b7ed
|
||||
sha256: b65d1f22442e6074948f501e7156c310fbf133cd63aa914c84d0d4db1c683ee0
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.5"
|
||||
version: "1.1.1"
|
||||
media_kit_libs_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -1606,10 +1606,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: video_player_media_kit
|
||||
sha256: "2d1e2389db93b9cbeba05d8b88d5eec1273675c7904e00c56ea08c776c6977a9"
|
||||
sha256: "7472fca414cfe372560d9328a3da9e57d9ba1de4af7ed8d887ce6a9868dc2430"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.0.21"
|
||||
version: "0.0.22"
|
||||
video_player_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
|
|||
|
|
@ -50,9 +50,9 @@ dependencies:
|
|||
flutter_web_auth_2: ^2.1.5
|
||||
numberpicker: ^2.1.2
|
||||
encrypt: ^5.0.1
|
||||
flutter_meedu_videoplayer: ^4.2.20
|
||||
media_kit_libs_android_video: ^1.0.6
|
||||
media_kit_libs_ios_video: ^1.0.4
|
||||
flutter_meedu_videoplayer: ^4.2.22
|
||||
media_kit_libs_android_video: ^1.3.0
|
||||
media_kit_libs_ios_video: ^1.1.1
|
||||
js_packer: ^0.0.5
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue