mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-27 14:59:29 +01:00
fix: Image viewer routing
This commit is contained in:
parent
2b83e69c1f
commit
7d6cbeec26
@ -25,7 +25,7 @@ class ImageViewerController extends State<ImageViewer> {
|
||||
}
|
||||
|
||||
/// Open this file with a system call.
|
||||
void openFileAction() => widget.event.openFile(context, downloadOnly: true);
|
||||
void openFileAction() => widget.event.openFile(context);
|
||||
|
||||
/// Go back if user swiped it away
|
||||
void onInteractionEnds(ScaleEndDetails endDetails) {
|
||||
|
@ -4,18 +4,9 @@ import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
|
||||
import 'matrix_file_extension.dart';
|
||||
import '../../pages/image_viewer.dart';
|
||||
import '../../widgets/matrix.dart';
|
||||
|
||||
extension LocalizedBody on Event {
|
||||
void openFile(BuildContext context, {bool downloadOnly = false}) async {
|
||||
if (!downloadOnly &&
|
||||
[MessageTypes.Image, MessageTypes.Sticker].contains(messageType)) {
|
||||
await Navigator.of(Matrix.of(context).navigatorContext).push(
|
||||
MaterialPageRoute(builder: (_) => ImageViewer(this)),
|
||||
);
|
||||
return;
|
||||
}
|
||||
void openFile(BuildContext context) async {
|
||||
final matrixFile = await showFutureLoadingDialog(
|
||||
context: context,
|
||||
future: () => downloadAndDecryptAttachmentCached(),
|
||||
|
@ -7,7 +7,6 @@ import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
|
||||
import '../../utils/matrix_sdk_extensions.dart/event_extension.dart';
|
||||
import '../matrix.dart';
|
||||
|
||||
class ImageBubble extends StatefulWidget {
|
||||
final Event event;
|
||||
@ -238,8 +237,8 @@ class _ImageBubbleState extends State<ImageBubble> {
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
if (!widget.tapToView) return;
|
||||
Navigator.of(Matrix.of(context).navigatorContext).push(
|
||||
MaterialPageRoute(
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (_) => ImageViewer(widget.event, onLoaded: () {
|
||||
// If the original file didn't load yet, we want to do that now.
|
||||
// This is so that the original file displays after going on the image viewer,
|
||||
@ -253,7 +252,6 @@ class _ImageBubbleState extends State<ImageBubble> {
|
||||
});
|
||||
}
|
||||
}),
|
||||
),
|
||||
);
|
||||
},
|
||||
child: Hero(
|
||||
|
Loading…
Reference in New Issue
Block a user