import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:teso/util/SizeConfig.dart'; import 'package:teso/util/consts.dart'; class ProductImage extends StatefulWidget { final productTag; final productImageSRC; const ProductImage( {Key? key, required this.productTag, required this.productImageSRC}) : super(key: key); @override _ProductImageState createState() => _ProductImageState(); } class _ProductImageState extends State { @override Widget build(BuildContext context) { SizeConfig().init(context); return Scaffold( body: Stack( children: [ Container( margin: EdgeInsets.symmetric( vertical: SizeConfig.safeBlockHorizontal * 8), child: new IconButton( onPressed: () { Navigator.of(context).pop(); }, icon: Container( width: 35, height: 35, decoration: BoxDecoration( shape: BoxShape.circle, color: Color.fromRGBO(0, 0, 0, 0.4), ), child: new Icon( Icons.arrow_back, color: Colors.white, size: 20.0, ), ), ), ), Container( width: MediaQuery.of(context).size.width, height: MediaQuery.of(context).size.height, child: GestureDetector( onTap: () { Navigator.pop(context); }, onVerticalDragUpdate: (details) { int sensitivity = 8; if (details.delta.dy < -sensitivity) { Navigator.pop(context); } }, child: Center( child: Hero( tag: widget.productTag, child: CachedNetworkImage( imageUrl: tesoProductThumbnail( productLogo: widget.productImageSRC), imageBuilder: (context, imageProvider) => Image( fit: BoxFit.fill, image: imageProvider, ), placeholder: (context, url) => Center( child: CupertinoActivityIndicator( animating: true, radius: 15, ), ), ), ), ), ), ), ], ), ); } }