This commit is contained in:
kodjomoustapha 2024-02-16 10:52:56 +01:00
parent 14885d3663
commit 94ebf47e4e
6 changed files with 27 additions and 27 deletions

View file

@ -797,7 +797,7 @@ class _AnimeStreamPageState extends riv.ConsumerState<AnimeStreamPage> {
await setFullScreen(value: false);
}
}
if (mounted) {
if (context.mounted) {
pushReplacementMangaReaderView(
context: context,
chapter: _streamController.getPrevEpisode());
@ -820,7 +820,7 @@ class _AnimeStreamPageState extends riv.ConsumerState<AnimeStreamPage> {
await setFullScreen(value: false);
}
}
if (mounted) {
if (context.mounted) {
pushReplacementMangaReaderView(
context: context,
chapter: _streamController.getNextEpisode(),

View file

@ -358,7 +358,7 @@ class _HistoryTabState extends ConsumerState<HistoryTab> {
.delete(
element.id!);
});
if (mounted) {
if (context.mounted) {
Navigator.pop(
context);
}

View file

@ -920,7 +920,7 @@ class _MangaDetailViewState extends ConsumerState<MangaDetailView>
);
}
_showDraggableMenu() {
void _showDraggableMenu() {
late TabController tabBarController;
tabBarController = TabController(length: 3, vsync: this);
tabBarController.animateTo(0);
@ -1652,7 +1652,7 @@ class _MangaDetailViewState extends ConsumerState<MangaDetailView>
..customCoverFromTracker =
trackSearch.coverUrl);
});
if (mounted) {
if (context.mounted) {
Navigator.pop(context);
}
}
@ -1719,7 +1719,7 @@ class _MangaDetailViewState extends ConsumerState<MangaDetailView>
});
}
}
if (mounted) {
if (context.mounted) {
Navigator.pop(context);
}
}
@ -1755,7 +1755,7 @@ class _MangaDetailViewState extends ConsumerState<MangaDetailView>
});
}
_editLocalArchiveInfos() {
void _editLocalArchiveInfos() {
final l10n = l10nLocalizations(context)!;
TextEditingController? name =
TextEditingController(text: widget.manga!.name!);
@ -1836,7 +1836,7 @@ class _MangaDetailViewState extends ConsumerState<MangaDetailView>
});
}
_trackingDraggableMenu(List<TrackPreference>? entries) {
void _trackingDraggableMenu(List<TrackPreference>? entries) {
DraggableMenu.open(
context,
DraggableMenu(

View file

@ -251,52 +251,53 @@ class _MangaChapterPageGalleryState
}
final usePageTapZones = ref.watch(usePageTapZonesStateProvider);
final l10n = l10nLocalizations(context)!;
return RawKeyboardListener(
return KeyboardListener(
autofocus: true,
focusNode: FocusNode(),
onKey: (event) {
onKeyEvent: (event) {
bool isLogicalKeyPressed(LogicalKeyboardKey key) =>
HardwareKeyboard.instance.isLogicalKeyPressed(key);
bool hasNextChapter = _readerController.getChapterIndex().$1 != 0;
bool hasPrevChapter = _readerController.getChapterIndex().$1 + 1 !=
_readerController
.getChaptersLength(_readerController.getChapterIndex().$2);
final action = switch (event.logicalKey) {
LogicalKeyboardKey.f11 =>
(!event.isKeyPressed(LogicalKeyboardKey.f11) || event.repeat)
(!isLogicalKeyPressed(LogicalKeyboardKey.f11))
? _setFullScreen()
: null,
LogicalKeyboardKey.escape =>
(!event.isKeyPressed(LogicalKeyboardKey.escape) || event.repeat)
(!isLogicalKeyPressed(LogicalKeyboardKey.escape))
? _goBack(context)
: null,
LogicalKeyboardKey.backspace =>
(!event.isKeyPressed(LogicalKeyboardKey.backspace) || event.repeat)
(!isLogicalKeyPressed(LogicalKeyboardKey.backspace))
? _goBack(context)
: null,
LogicalKeyboardKey.arrowUp =>
(!event.isKeyPressed(LogicalKeyboardKey.arrowUp) || event.repeat)
(!isLogicalKeyPressed(LogicalKeyboardKey.arrowUp))
? _onBtnTapped(_currentIndex! - 1, true)
: null,
LogicalKeyboardKey.arrowLeft =>
(!event.isKeyPressed(LogicalKeyboardKey.arrowLeft) || event.repeat)
(!isLogicalKeyPressed(LogicalKeyboardKey.arrowLeft))
? _isReverseHorizontal
? _onBtnTapped(_currentIndex! + 1, false)
: _onBtnTapped(_currentIndex! - 1, true)
: null,
LogicalKeyboardKey.arrowRight =>
(!event.isKeyPressed(LogicalKeyboardKey.arrowRight) || event.repeat)
(!isLogicalKeyPressed(LogicalKeyboardKey.arrowRight))
? _isReverseHorizontal
? _onBtnTapped(_currentIndex! - 1, true)
: _onBtnTapped(_currentIndex! + 1, false)
: null,
LogicalKeyboardKey.arrowDown =>
(!event.isKeyPressed(LogicalKeyboardKey.arrowDown) || event.repeat)
(!isLogicalKeyPressed(LogicalKeyboardKey.arrowDown))
? _onBtnTapped(_currentIndex! + 1, true)
: null,
LogicalKeyboardKey.keyN ||
LogicalKeyboardKey.pageDown =>
((!event.isKeyPressed(LogicalKeyboardKey.keyN) ||
!event.isKeyPressed(LogicalKeyboardKey.pageDown)) ||
event.repeat)
((!isLogicalKeyPressed(LogicalKeyboardKey.keyN) ||
!isLogicalKeyPressed(LogicalKeyboardKey.pageDown)))
? switch (hasNextChapter) {
true => pushReplacementMangaReaderView(
context: context,
@ -307,9 +308,8 @@ class _MangaChapterPageGalleryState
: null,
LogicalKeyboardKey.keyP ||
LogicalKeyboardKey.pageUp =>
((!event.isKeyPressed(LogicalKeyboardKey.keyP) ||
!event.isKeyPressed(LogicalKeyboardKey.pageUp)) ||
event.repeat)
((!isLogicalKeyPressed(LogicalKeyboardKey.keyP) ||
!isLogicalKeyPressed(LogicalKeyboardKey.pageUp)))
? switch (hasPrevChapter) {
true => pushReplacementMangaReaderView(
context: context,

View file

@ -183,7 +183,7 @@ class _CategoriesTabState extends ConsumerState<CategoriesTab> {
index]
.id!);
});
if (mounted) {
if (context.mounted) {
Navigator.pop(
context);
}
@ -273,7 +273,7 @@ class _CategoriesTabState extends ConsumerState<CategoriesTab> {
name: controller.text,
));
});
if (mounted) {
if (context.mounted) {
Navigator.pop(context);
}
},
@ -359,7 +359,7 @@ class _CategoriesTabState extends ConsumerState<CategoriesTab> {
category.name = controller.text;
await isar.categorys.put(category);
});
if (mounted) {
if (context.mounted) {
Navigator.pop(context);
}
},

View file

@ -73,7 +73,7 @@ class _DownloadsScreenState extends ConsumerState<DownloadsScreen> {
.notifier)
.set(result);
} else {}
if (!mounted) return;
if (!context.mounted) return;
Navigator.pop(context);
},
title: Text(l10n.custom_location)),