mirror of
https://github.com/lifegpc/eh_downloader_flutter.git
synced 2026-07-08 01:30:28 +08:00
Fix bug
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:dio_image_provider/dio_image_provider.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/scheduler.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
@@ -12,6 +13,7 @@ import 'package:photo_view/photo_view_gallery.dart';
|
||||
import '../api/file.dart';
|
||||
import '../api/gallery.dart';
|
||||
import '../globals.dart';
|
||||
import '../platform/replace_current_route.dart';
|
||||
|
||||
final _log = Logger("SinglePageViewer");
|
||||
|
||||
@@ -84,6 +86,7 @@ class _SinglePageViewer extends State<SinglePageViewer> with ThemeModeWidget {
|
||||
}
|
||||
setState(() {
|
||||
_files = fileData;
|
||||
_error = null;
|
||||
_isLoading = false;
|
||||
});
|
||||
}
|
||||
@@ -99,9 +102,15 @@ class _SinglePageViewer extends State<SinglePageViewer> with ThemeModeWidget {
|
||||
}
|
||||
|
||||
void _onPageChanged(BuildContext context) {
|
||||
context.replace("/gallery/${widget.gid}/page/${_index + 1}",
|
||||
GoRouter.optionURLReflectsImperativeAPIs = false;
|
||||
final q = "/gallery/${widget.gid}/page/${_index + 1}";
|
||||
context.replace(q,
|
||||
extra: SinglePageViewerExtra(data: _data, files: _files));
|
||||
GoRouter.optionURLReflectsImperativeAPIs = true;
|
||||
_page_changed = false;
|
||||
if (kIsWeb) {
|
||||
replaceCurrentRoute(q);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -152,7 +161,6 @@ class _SinglePageViewer extends State<SinglePageViewer> with ThemeModeWidget {
|
||||
bindings: [
|
||||
KeyAction(LogicalKeyboardKey.arrowLeft, "previous page", () {
|
||||
if (_index > 0) {
|
||||
_index -= 1;
|
||||
_pageController.previousPage(
|
||||
duration: const Duration(milliseconds: 200),
|
||||
curve: Curves.easeInOut);
|
||||
@@ -160,7 +168,6 @@ class _SinglePageViewer extends State<SinglePageViewer> with ThemeModeWidget {
|
||||
}),
|
||||
KeyAction(LogicalKeyboardKey.arrowRight, "next page", () {
|
||||
if (_index < _data!.pages.length - 1) {
|
||||
_index += 1;
|
||||
_pageController.nextPage(
|
||||
duration: const Duration(milliseconds: 200),
|
||||
curve: Curves.easeInOut);
|
||||
|
||||
Reference in New Issue
Block a user