From 4a5bb17afbd9e70a56dd5784e6022990f6d80617 Mon Sep 17 00:00:00 2001 From: krawieck Date: Fri, 11 Sep 2020 19:29:17 +0200 Subject: [PATCH] Make image inside markdown fullscreenable --- lib/widgets/markdown_text.dart | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/lib/widgets/markdown_text.dart b/lib/widgets/markdown_text.dart index 7ef6878..c0a9702 100644 --- a/lib/widgets/markdown_text.dart +++ b/lib/widgets/markdown_text.dart @@ -1,6 +1,7 @@ import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter/material.dart'; import 'package:flutter_markdown/flutter_markdown.dart'; +import 'package:lemmur/pages/media_view.dart'; import 'package:markdown/markdown.dart' as md; import '../url_launcher.dart'; @@ -24,13 +25,20 @@ class MarkdownText extends StatelessWidget { ), ))); }, - imageBuilder: (uri, title, alt) => CachedNetworkImage( - imageUrl: uri.toString(), - errorWidget: (context, url, error) => Row( - children: [ - Icon(Icons.warning), - Text("couldn't load image, ${error.toString()}") - ], + imageBuilder: (uri, title, alt) => InkWell( + onTap: () { + Navigator.of(context).push(MaterialPageRoute( + builder: (context) => MediaViewPage(uri.toString()), + )); + }, + child: CachedNetworkImage( + imageUrl: uri.toString(), + errorWidget: (context, url, error) => Row( + children: [ + Icon(Icons.warning), + Text("couldn't load image, ${error.toString()}") + ], + ), ), ), );