39 lines
1.1 KiB
Dart
39 lines
1.1 KiB
Dart
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;
|
|
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(
|
|
backgroundColor: primaryColor,
|
|
title: Text(widget.fileName, style: TextStyle(color: Colors.white)),
|
|
iconTheme: new IconThemeData(color: Colors.white),
|
|
),
|
|
body: Center(
|
|
child: PhotoView(
|
|
imageProvider: widget.url != null
|
|
? NetworkImage(widget.url)
|
|
: widget.imageFile != null
|
|
? FileImage(widget.imageFile)
|
|
: AssetImage(widget.localImage),
|
|
minScale: PhotoViewComputedScale.contained * 1)),
|
|
);
|
|
}
|
|
}
|