chore: Follow up imageviewer
This commit is contained in:
parent
b2131e65e5
commit
1ef0289b6a
2 changed files with 21 additions and 9 deletions
|
|
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
|||
|
||||
import 'package:matrix/matrix.dart';
|
||||
|
||||
import 'package:fluffychat/config/themes.dart';
|
||||
import 'package:fluffychat/pages/image_viewer/image_viewer_view.dart';
|
||||
import 'package:fluffychat/utils/platform_infos.dart';
|
||||
import 'package:fluffychat/utils/show_scaffold_dialog.dart';
|
||||
|
|
@ -44,6 +45,24 @@ class ImageViewerController extends State<ImageViewer> {
|
|||
|
||||
late final List<Event> allEvents;
|
||||
|
||||
void prevImage() {
|
||||
setState(() {
|
||||
pageController.previousPage(
|
||||
duration: FluffyThemes.animationDuration,
|
||||
curve: FluffyThemes.animationCurve,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
void nextImage() {
|
||||
setState(() {
|
||||
pageController.nextPage(
|
||||
duration: FluffyThemes.animationDuration,
|
||||
curve: FluffyThemes.animationCurve,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
int get _index => pageController.page?.toInt() ?? 0;
|
||||
|
||||
Event get currentEvent => allEvents[_index];
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
|
|||
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
|
||||
import 'package:fluffychat/config/themes.dart';
|
||||
import 'package:fluffychat/utils/platform_infos.dart';
|
||||
import 'package:fluffychat/widgets/hover_builder.dart';
|
||||
import 'package:fluffychat/widgets/mxc_image.dart';
|
||||
|
|
@ -104,10 +103,7 @@ class ImageViewerView extends StatelessWidget {
|
|||
style: iconButtonStyle,
|
||||
tooltip: L10n.of(context).previous,
|
||||
icon: const Icon(Icons.chevron_left_outlined),
|
||||
onPressed: () => controller.pageController.previousPage(
|
||||
duration: FluffyThemes.animationDuration,
|
||||
curve: FluffyThemes.animationCurve,
|
||||
),
|
||||
onPressed: controller.prevImage,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
@ -120,10 +116,7 @@ class ImageViewerView extends StatelessWidget {
|
|||
style: iconButtonStyle,
|
||||
tooltip: L10n.of(context).next,
|
||||
icon: const Icon(Icons.chevron_right_outlined),
|
||||
onPressed: () => controller.pageController.nextPage(
|
||||
duration: FluffyThemes.animationDuration,
|
||||
curve: FluffyThemes.animationCurve,
|
||||
),
|
||||
onPressed: controller.nextImage,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue