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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue