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 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,