fix: Navigator context
This commit is contained in:
parent
fbac47d679
commit
71e020d8a4
4 changed files with 11 additions and 9 deletions
|
|
@ -5,12 +5,13 @@ 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(context, rootNavigator: true).push(
|
||||
await Navigator.of(Matrix.of(context).navigatorContext).push(
|
||||
MaterialPageRoute(builder: (_) => ImageViewer(this)),
|
||||
);
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ 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;
|
||||
|
|
@ -237,7 +238,7 @@ class _ImageBubbleState extends State<ImageBubble> {
|
|||
child: InkWell(
|
||||
onTap: () {
|
||||
if (!widget.tapToView) return;
|
||||
Navigator.of(context, rootNavigator: true).push(
|
||||
Navigator.of(Matrix.of(context).navigatorContext).push(
|
||||
MaterialPageRoute(
|
||||
builder: (_) => ImageViewer(widget.event, onLoaded: () {
|
||||
// If the original file didn't load yet, we want to do that now.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue