95 lines
3.2 KiB
Dart
95 lines
3.2 KiB
Dart
import 'dart:ui';
|
|
import 'package:birzha/components/imagePlaceHolder.dart';
|
|
import 'package:cached_network_image/cached_network_image.dart';
|
|
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:photo_view/photo_view.dart';
|
|
import 'package:birzha/components/indicator.dart';
|
|
import 'package:birzha/core/adaptix/adaptix.dart';
|
|
|
|
class PhotoScreen extends StatefulWidget{
|
|
final String image;
|
|
PhotoScreen(this.image);
|
|
|
|
@override
|
|
_PhotoScreenState createState()=> _PhotoScreenState();
|
|
|
|
}
|
|
|
|
class _PhotoScreenState extends State<PhotoScreen>{
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
super.dispose();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
|
|
final double paddingTop = MediaQueryData.fromWindow(window).padding.top;
|
|
final double verticalMarginTitle =
|
|
MediaQuery.of(context).size.width * (32 / 452);
|
|
|
|
return Container(
|
|
color: Colors.white,
|
|
child: Stack(
|
|
children: <Widget>[
|
|
Hero(
|
|
tag: 'detailedPhoto',
|
|
child: Center(
|
|
child: PhotoView(
|
|
errorBuilder: (_, __, ___) => AppImagePlaceholder(),
|
|
loadingBuilder: (_, chunk) => Container(
|
|
color: Colors.white,
|
|
alignment: Alignment.center,
|
|
child: Container(
|
|
padding: EdgeInsets.symmetric(
|
|
vertical: verticalMarginTitle),
|
|
alignment: Alignment.center,
|
|
child: Indicator(size: 0.7.adaptedPx(),color: Theme.of(context).accentColor,)
|
|
)),
|
|
imageProvider: CachedNetworkImageProvider(
|
|
widget.image
|
|
),
|
|
backgroundDecoration: BoxDecoration(
|
|
color: Colors.transparent
|
|
),
|
|
),
|
|
),
|
|
),
|
|
OrientationBuilder(
|
|
builder: (cntxt, orientation){
|
|
|
|
double height = (orientation == Orientation.portrait?
|
|
MediaQuery.of(context).size.height: MediaQuery.of(context).size.width)*0.049;
|
|
|
|
return Container(
|
|
height: height,
|
|
alignment: Alignment.centerRight,
|
|
width: MediaQuery.of(context).size.width*0.98,
|
|
margin: EdgeInsets.only(top: paddingTop),
|
|
child: FittedBox(
|
|
child: Material(
|
|
color: Colors.transparent,
|
|
child: InkWell(
|
|
onTap: () => Navigator.of(cntxt).pop(),
|
|
child: Icon(
|
|
CupertinoIcons.clear_fill,
|
|
color: Theme.of(context).accentColor,
|
|
size:30.adaptedPx(),
|
|
),
|
|
),
|
|
)
|
|
)
|
|
);
|
|
},
|
|
)
|
|
],
|
|
));
|
|
}
|
|
} |