Skip to content

A widget that makes picture pinch zoom, then return back to initial size and position when released.

License

Notifications You must be signed in to change notification settings

ossolution/pinch_zoom_image

 
 

Repository files navigation

Pinch Zoom Image

A widget that makes picture pinch zoom, Instagram style!

Example one Example two

Installation

Add this to your pubspec.yml dependencies:

pos_pinch_zoom_image: "^0.1.0"

How to use

Add the widget to your app like this (It automatically takes the size of the image you pass to it):

PinchZoomImage(
  image: Image.network('https://i.imgur.com/tKg0XEb.jpg'),
  zoomedBackgroundColor: Color.fromRGBO(240, 240, 240, 1.0),
  hideStatusBarWhileZooming: true,
  onZoomStart: () {
    print('Zoom started');
  },
  onZoomEnd: () {
    print('Zoom finished');
  },
),

The zoomedBackgroundColor is the color that fills the image's space when the use is zooming it and moving it on the screen.

If you want images from internet to be cached for offline use or data saving, you can also use this with the cached_network_image widget:

PinchZoomImage(
  image: CachedNetworkImage(
    imageUrl: 'https://i.imgur.com/tKg0XEb.jpg',
  ),
  zoomedBackgroundColor: Color.fromRGBO(240, 240, 240, 1.0),
  hideStatusBarWhileZooming: true,
),

Enjoy!

About

A widget that makes picture pinch zoom, then return back to initial size and position when released.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Dart 61.0%
  • Ruby 14.0%
  • Kotlin 10.1%
  • Swift 7.4%
  • HTML 5.4%
  • Objective-C 2.1%