import 'package:flutter/material.dart';
import 'package:photo_view/photo_view.dart';
import 'Constants.dart';

class ImageZoomin extends StatefulWidget {
  final String message;
  const ImageZoomin({required this.message});

  @override
  State<ImageZoomin> createState() => _MyWidgetState();
}

class _MyWidgetState extends State<ImageZoomin> {
  String image = '';
  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    image = widget.message;
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Image Zoom In '),
        flexibleSpace: Container(
          decoration: BoxDecoration(
            gradient: Constants.getReturn(),
          ),
        ),
      ),
      body: PhotoView.customChild(
        childSize: const Size(400, 400),
        initialScale: PhotoViewComputedScale.contained,
        minScale: PhotoViewComputedScale.contained * 0.8,
        maxScale: PhotoViewComputedScale.covered * 2,
        enableRotation: true,
        child: PhotoView(
          imageProvider: NetworkImage(image),
          backgroundDecoration: const BoxDecoration(
            image: DecorationImage(
              image: AssetImage('assets/images/camera.png'),
              fit: BoxFit.cover,
            ),
          ),
        ),
      ),
    );
  }
}
