import 'dart:io';

import 'package:fcs/helpers/theme.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;
  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()),
    );
  }
}
