2020-05-29 07:45:27 +06:30
|
|
|
import 'dart:io';
|
|
|
|
|
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:photo_view/photo_view.dart';
|
2020-09-04 15:30:10 +06:30
|
|
|
import 'package:fcs/fcs/common/helpers/theme.dart';
|
2020-05-29 07:45:27 +06:30
|
|
|
|
|
|
|
|
class ShowImage extends StatefulWidget {
|
|
|
|
|
final String url;
|
|
|
|
|
final File imageFile;
|
|
|
|
|
final String fileName;
|
|
|
|
|
const ShowImage({Key key, this.imageFile, this.fileName, this.url})
|
|
|
|
|
: super(key: key);
|
|
|
|
|
@override
|
|
|
|
|
_ShowImageState createState() => _ShowImageState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _ShowImageState extends State<ShowImage> {
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return Scaffold(
|
|
|
|
|
appBar: AppBar(
|
|
|
|
|
backgroundColor: primaryColor,
|
|
|
|
|
title: Text(widget.fileName),
|
|
|
|
|
),
|
|
|
|
|
body: Center(
|
|
|
|
|
child: widget.url != null || widget.imageFile != null
|
|
|
|
|
? PhotoView(
|
|
|
|
|
imageProvider: widget.url != null
|
|
|
|
|
? NetworkImage(widget.url)
|
|
|
|
|
: FileImage(widget.imageFile),
|
|
|
|
|
minScale: PhotoViewComputedScale.contained * 1)
|
|
|
|
|
: Container()),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|