Flutter - PhotoView

678 views Asked by At

Tell me, is it possible to increase (or decrease) the image in the Photo View widget, to return the image to its original state after removing your fingers from the screen? Or is it possible to implement this using other widgets?

1

There are 1 answers

0
Stick On

You can do it in pub dev using this pinch_zoom_image_last package. You can use the following code as an example.

import 'package:flutter/material.dart';
import 'package:pinch_zoom_image_last/pinch_zoom_image_last.dart';

class ZoomWidget extends StatelessWidget {
  final String imagePath;

  ZoomWidget(this.imagePath);

  Widget build(BuildContext context) {
    return PinchZoomImage(
      image: Image.network(imagePath),
      zoomedBackgroundColor: const Color.fromRGBO(240, 240, 240, 1.0),
      // hideStatusBarWhileZooming: true,
      onZoomStart: () {
        print('Zoom started');
      },
      onZoomEnd: () {
        print('Zoom finished');
      },
    );
  }
}