parent
c6eadb8a0e
commit
c1af00fcad
@ -0,0 +1,46 @@
|
||||
part of ansu_ui;
|
||||
|
||||
class PhotoViewer extends StatefulWidget {
|
||||
final File file;
|
||||
final String tag;
|
||||
PhotoViewer({Key key, this.file, this.tag}) : super(key: key);
|
||||
|
||||
@override
|
||||
_PhotoViewerState createState() => _PhotoViewerState();
|
||||
}
|
||||
|
||||
class _PhotoViewerState extends State<PhotoViewer> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.black54,
|
||||
body: GestureDetector(
|
||||
onTap: () => Navigator.pop(context),
|
||||
child: Center(
|
||||
child: InteractiveViewer(
|
||||
boundaryMargin: 100.edge,
|
||||
child: Hero(
|
||||
tag: widget.tag,
|
||||
child: Image.file(widget.file),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
toPhotoViewer(BuildContext context, {String tag, File file}) {
|
||||
Navigator.push(
|
||||
context,
|
||||
PageRouteBuilder(
|
||||
pageBuilder: (context, animation, secondAnimation) {
|
||||
return PhotoViewer(file: file, tag: tag);
|
||||
},
|
||||
opaque: false,
|
||||
transitionsBuilder: (context, animation, secondaryAnimation, child) {
|
||||
return FadeTransition(opacity: animation, child: child);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
Loading…
Reference in new issue