From 8613010c5e34db3bc502df04cb2501174752e9fa Mon Sep 17 00:00:00 2001 From: Krille Date: Mon, 6 Jan 2025 10:56:02 +0100 Subject: [PATCH] chore: Follow up image viewer --- lib/pages/image_viewer/image_viewer.dart | 28 ++++++++++++------------ 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/lib/pages/image_viewer/image_viewer.dart b/lib/pages/image_viewer/image_viewer.dart index e99eb719b..2b2b315e0 100644 --- a/lib/pages/image_viewer/image_viewer.dart +++ b/lib/pages/image_viewer/image_viewer.dart @@ -45,22 +45,22 @@ class ImageViewerController extends State { late final List allEvents; - void prevImage() { - setState(() { - pageController.previousPage( - duration: FluffyThemes.animationDuration, - curve: FluffyThemes.animationCurve, - ); - }); + void prevImage() async { + await pageController.previousPage( + duration: FluffyThemes.animationDuration, + curve: FluffyThemes.animationCurve, + ); + if (!mounted) return; + setState(() {}); } - void nextImage() { - setState(() { - pageController.nextPage( - duration: FluffyThemes.animationDuration, - curve: FluffyThemes.animationCurve, - ); - }); + void nextImage() async { + await pageController.nextPage( + duration: FluffyThemes.animationDuration, + curve: FluffyThemes.animationCurve, + ); + if (!mounted) return; + setState(() {}); } int get _index => pageController.page?.toInt() ?? 0;