Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

flutter flutter logo photo view

a simple zoomable image widget for flutter

photo view is useful in full-screen exhibition cases.

resolves an image provider and show the result with useful gestures support, such as pinch to zoom and pan.

photo view - zoomable images

installation

add photo_view as a dependency in your pubspec.yaml file.

import photo view:

import 'package:photo_view/photo_view.dart';

sample code

given a imageprovider imageprovider (such as assetimage or networkimage):

@override
widget build(buildcontext context) {
  return new container(
    child: new photoview(
      imageprovider: assetimage("assets/large-image.jpg"),
      minscale: photoviewcomputedscale.contained * 0.8,
      maxscale: 4.0,
    );
  );
}

inline usage

if you want photoview to scale the image in container with size different than the screen, use photoviewinline instead.

@override
widget build(buildcontext context) {
  return new container(
    child: new photoviewinline(
      imageprovider: assetimage("assets/large-image.jpg"),
      minscale: photoviewcomputedscale.contained * 0.8,
      maxscale: 4.0,
    );
  );
}

api

for more information about how to use photo view, check the api docs

screenshots

limited scaleinlinehero animation
in actionin actionin action

todo:

  • [x] scale on doubletap
  • [x] zoom when pinched
  • [x] respect screen and image boundaries
  • [x] center image when zooming out
  • [x] add image zoom limits (minscale an maxscale)
  • [x] add gif support
  • [ ] multiple image support (gallery mode)
  • [ ] rotate gesture rotates image (work in progress)

pull requests are welcome.

download the full project for this post from the following button

this source is fully free for all time

download as zip


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

Comments are closed.