mark props as required and move onTap to a method

This commit is contained in:
krawieck 2020-09-11 20:36:19 +02:00
parent 6cc894be2c
commit 1746cc0db5
1 changed files with 12 additions and 6 deletions

View File

@ -6,16 +6,22 @@ class FullscreenableImage extends StatelessWidget {
final String url; final String url;
final Widget child; 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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return InkWell( return InkWell(
onTap: () { onTap: () => _onTap(context),
Navigator.of(context).push(MaterialPageRoute(
builder: (context) => MediaViewPage(url),
));
},
child: Hero( child: Hero(
tag: url, tag: url,
child: child, child: child,