Files
fcs/lib/pages/widgets/show_img.dart

47 lines
1.4 KiB
Dart
Raw Normal View History

2020-09-17 06:02:48 +06:30
import 'dart:io';
2020-10-07 02:33:06 +06:30
import 'package:fcs/helpers/theme.dart';
2020-10-28 05:11:06 +06:30
import 'package:flutter/cupertino.dart';
2020-09-17 06:02:48 +06:30
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;
2020-10-16 21:38:39 +06:30
final String localImage;
const ShowImage(
{Key key, this.imageFile, this.fileName, this.url, this.localImage})
2020-09-17 06:02:48 +06:30
: super(key: key);
@override
_ShowImageState createState() => _ShowImageState();
}
class _ShowImageState extends State<ShowImage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
2020-10-28 05:11:06 +06:30
leading: new IconButton(
icon: new Icon(Icons.close),
onPressed: () => Navigator.of(context).pop(),
),
2020-09-17 06:02:48 +06:30
backgroundColor: primaryColor,
2020-10-28 05:11:06 +06:30
shadowColor: Colors.transparent,
2020-10-16 21:38:39 +06:30
iconTheme: new IconThemeData(color: Colors.white),
2020-09-17 06:02:48 +06:30
),
body: Center(
2020-10-16 21:38:39 +06:30
child: PhotoView(
2020-10-28 05:11:06 +06:30
backgroundDecoration: const BoxDecoration(
color: primaryColor,
),
2020-10-16 21:38:39 +06:30
imageProvider: widget.url != null
? NetworkImage(widget.url)
: widget.imageFile != null
? FileImage(widget.imageFile)
: AssetImage(widget.localImage),
minScale: PhotoViewComputedScale.contained * 1)),
2020-09-17 06:02:48 +06:30
);
}
}