2020-09-16 22:53:04 +02:00
|
|
|
import 'package:flutter/cupertino.dart';
|
2020-09-11 20:26:06 +02:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
import '../pages/media_view.dart';
|
2020-09-16 22:53:04 +02:00
|
|
|
import '../util/goto.dart';
|
2020-09-11 20:26:06 +02:00
|
|
|
|
2020-09-30 19:05:00 +02:00
|
|
|
/// If the media is pressed, it opens itself in a [MediaViewPage]
|
2020-09-11 20:26:06 +02:00
|
|
|
class FullscreenableImage extends StatelessWidget {
|
|
|
|
final String url;
|
|
|
|
final Widget child;
|
|
|
|
|
2020-09-11 20:36:19 +02:00
|
|
|
const FullscreenableImage({
|
|
|
|
Key key,
|
|
|
|
@required this.url,
|
|
|
|
@required this.child,
|
|
|
|
}) : super(key: key);
|
|
|
|
|
|
|
|
_onTap(BuildContext c) {
|
2020-09-16 22:53:04 +02:00
|
|
|
goTo(c, (context) => MediaViewPage(url));
|
2020-09-11 20:36:19 +02:00
|
|
|
}
|
2020-09-11 20:26:06 +02:00
|
|
|
|
|
|
|
@override
|
2020-09-11 21:21:58 +02:00
|
|
|
Widget build(BuildContext context) => InkWell(
|
|
|
|
onTap: () => _onTap(context),
|
|
|
|
child: Hero(
|
|
|
|
tag: url,
|
|
|
|
child: child,
|
|
|
|
),
|
|
|
|
);
|
2020-09-11 20:26:06 +02:00
|
|
|
}
|