From 1746cc0db5c8b8cc2ea61ff7871b422402a448ab Mon Sep 17 00:00:00 2001 From: krawieck Date: Fri, 11 Sep 2020 20:36:19 +0200 Subject: [PATCH] mark props as required and move onTap to a method --- lib/widgets/fullscreenable_image.dart | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/lib/widgets/fullscreenable_image.dart b/lib/widgets/fullscreenable_image.dart index c49b957..dc68740 100644 --- a/lib/widgets/fullscreenable_image.dart +++ b/lib/widgets/fullscreenable_image.dart @@ -6,16 +6,22 @@ class FullscreenableImage extends StatelessWidget { final String url; final Widget child; - const FullscreenableImage({Key key, this.url, this.child}) : super(key: key); + const FullscreenableImage({ + Key key, + @required this.url, + @required this.child, + }) : super(key: key); + + _onTap(BuildContext c) { + Navigator.of(c).push(MaterialPageRoute( + builder: (context) => MediaViewPage(url), + )); + } @override Widget build(BuildContext context) { return InkWell( - onTap: () { - Navigator.of(context).push(MaterialPageRoute( - builder: (context) => MediaViewPage(url), - )); - }, + onTap: () => _onTap(context), child: Hero( tag: url, child: child,