Files
fcs/lib/pages/widgets/show_img.dart
Sai Naw Wun d5c2407545 add payment
2020-10-28 05:11:06 +06:30

47 lines
1.4 KiB
Dart

import 'dart:io';
import 'package:fcs/helpers/theme.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:photo_view/photo_view.dart';
class ShowImage extends StatefulWidget {
final String url;
final File imageFile;
final String fileName;
final String localImage;
const ShowImage(
{Key key, this.imageFile, this.fileName, this.url, this.localImage})
: super(key: key);
@override
_ShowImageState createState() => _ShowImageState();
}
class _ShowImageState extends State<ShowImage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
leading: new IconButton(
icon: new Icon(Icons.close),
onPressed: () => Navigator.of(context).pop(),
),
backgroundColor: primaryColor,
shadowColor: Colors.transparent,
iconTheme: new IconThemeData(color: Colors.white),
),
body: Center(
child: PhotoView(
backgroundDecoration: const BoxDecoration(
color: primaryColor,
),
imageProvider: widget.url != null
? NetworkImage(widget.url)
: widget.imageFile != null
? FileImage(widget.imageFile)
: AssetImage(widget.localImage),
minScale: PhotoViewComputedScale.contained * 1)),
);
}
}