fix: Image viewer
This commit is contained in:
parent
83f886a088
commit
dcfbf8f8a5
5 changed files with 71 additions and 99 deletions
|
|
@ -1,10 +1,10 @@
|
|||
import 'package:famedlysdk/famedlysdk.dart';
|
||||
import 'package:fluffychat/pages/image_viewer.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter_blurhash/flutter_blurhash.dart';
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:vrouter/vrouter.dart';
|
||||
|
||||
import '../../utils/matrix_sdk_extensions.dart/event_extension.dart';
|
||||
|
||||
|
|
@ -237,8 +237,23 @@ class _ImageBubbleState extends State<ImageBubble> {
|
|||
child: InkWell(
|
||||
onTap: () {
|
||||
if (!widget.tapToView) return;
|
||||
VRouter.of(context).push(
|
||||
'/rooms/${widget.event.room.id}/image/${widget.event.eventId}');
|
||||
Navigator.of(context, rootNavigator: true).push(
|
||||
MaterialPageRoute(
|
||||
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,
|
||||
// waiting for it to load, and then hitting back. This ensures that we always
|
||||
// display the best image available, with requiring as little network as possible
|
||||
if (_file == null) {
|
||||
widget.event.isAttachmentCached().then((cached) {
|
||||
if (cached) {
|
||||
_requestFile();
|
||||
}
|
||||
});
|
||||
}
|
||||
}),
|
||||
),
|
||||
);
|
||||
},
|
||||
child: Hero(
|
||||
tag: widget.event.eventId,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue