A plugin for panning and zooming images by touch.

Overview

zoomable_image

A dart+flutter package for panning and zooming images by touch.

Getting Started

// You can use any ImageProvider, including NetworkImage and FileImage.
new ZoomableImage(new AssetImage('images/squirrel.jpg'), scale: 16.0)

That's all you need. See below and example/ for squirrels.

demo!

Comments
  • Need update to Dart SDK 2.x

    Need update to Dart SDK 2.x

    The current Dart SDK version is 2.1.0-dev.0.0.flutter-be6309690f.

    Because zoomable_image 1.2.0 requires SDK version >=1.19.0 <2.0.0 and no versions of zoomable_image match >1.2.0 <2.0.0, zoomable_image ^1.2.0 is forbidden. So, because flutter_test_1 depends on zoomable_image ^1.2.0, version solving failed. pub get failed (1)

    opened by Mythar 3
  • Gestures not working if ZoomableImage is wrapped in a Scaffold

    Gestures not working if ZoomableImage is wrapped in a Scaffold

    In the method _child(), it seems like the CustomPaint() that is instantiated requires a valid "child" object in order for the gesture detector to function correctly if used in a Scaffold.

    I added an empty container as a child, and then things started working as expected, so I believe this may be related to this mentioned in the docs on CustomPaint:

    Custom painters normally size themselves to their child. If they do not have a child, they attempt to size themselves to the size, which defaults to Size.zero.

    bug 
    opened by hugovangalen 3
  • Name field in pubspec does not match

    Name field in pubspec does not match

    in order to reference this package I think the name in pubspec has to be the same as in the url. URL: flutter_zoomable_image PUBSPEC: zoomable_image

    zoomable_image:
        git:
          url: https://github.com/perlatus/flutter_zoomable_image.git
    

    Error on get Packages:

    C:\sdks\flutter\bin\flutter.bat --no-color packages get Running "flutter packages get" in lookatmybaby_flutter... Error on line 1, column 7: "name" field doesn't match expected name "flutter_zoomable_image". name: zoomable_image ^^^^^^^^^^^^^^

    opened by ride4sun 1
  • Fix for zoom jitter.

    Fix for zoom jitter.

    Whenever I zoomed in there was an annoying jitter - this was caused by using the old zoom to calculate the new offset. Now zooming in completely smooth in my project.

    opened by owaineevans 1
  • PagerView render problem when scroll pages or when open pager

    PagerView render problem when scroll pages or when open pager

    ZoomView has render problem when I use it inside PagerView with NetworkImage provider. When open screen with pager or scrolling pager from one image to another during one second instead next image you can error screen, after one second everything okey before you start scrolling again.

    opened by llOldmenll 0
  • Image Zooms Out Too Far and Image Scrolls Out of Viewport

    Image Zooms Out Too Far and Image Scrolls Out of Viewport

    The user is able to zoom out until the image disappears. This fixed it for me:

    I changed:

      void _handleScaleUpdate(Size size, ScaleUpdateDetails d) {
        double newZoom = _previousZoom * d.scale;
        bool tooZoomedIn = _image.width * _scale / newZoom <= size.width ||
            _image.height * _scale / newZoom <= size.height;
        
        if (tooZoomedIn) {
          return;
        }
    

    to:

      void _handleScaleUpdate(Size size, ScaleUpdateDetails d) {
        double newZoom = _previousZoom * d.scale;
        bool tooZoomedIn = _image.width * _scale / newZoom <= size.width ||
            _image.height * _scale / newZoom <= size.height;
          
        // Too Zoomed Out
        if (newZoom < 0.9)
            newZoom = 0.9;
          
        if (tooZoomedIn) {
            return;
        }
    

    where 0.9 is the "give" or "leeway" so that the image can zoom out a little.

    Image Scrolls out of Viewport. I fixed this in the Horizontal direction, but not the vertical. In the same function, I changed:

    // Ensure that item under the focal point stays in the same place despite zooming
        final Offset normalizedOffset =
            (_startingFocalPoint - _previousOffset) / _previousZoom;
        Offset newOffset = d.focalPoint / _scale - normalizedOffset * _zoom;
        
        setState(() {
          _zoom = newZoom;
          _offset = newOffset;
        });
      }
    

    to this:

    // Ensure that item under the focal point stays in the same place despite zooming
        final Offset normalizedOffset =
            (_startingFocalPoint - _previousOffset) / _previousZoom;
        Offset newOffset = d.focalPoint / _scale - normalizedOffset * _zoom;
        
        // Out of Bounds X]
        double give = 20.0;
        if (newOffset.dx > give/_scale) 
            newOffset = newOffset.scale(0.0, 1.0).translate(give/_scale, 0.0);  
        else if (newOffset.dx*_scale + size.width*_zoom < size.width - give)
            newOffset = newOffset.scale(0.0, 1.0).translate((size.width - size.width*_zoom - give)/_scale, 0.0);
          
        setState(() {
          _zoom = newZoom;
          _offset = newOffset;
        });
      }
    

    Here the variable "give" is the padding around the picture when it moves to its extreme right or left. Feel free to incorporate this into your code. No attribution or anything necessary. Sorry I couldn't do any fancy animations, but maybe you can figure it out.

    opened by samvictor 1
  • Missing boundaries

    Missing boundaries

    It's possible to continue panning the image way off the canvas. Some users have reported crashes, and it's also possible to lose track of where the image is.

    We need a stopgap solution to prevent overscrolling until #2 can be implemented.

    bug 
    opened by perlatus 0
  • Keep position when rotating screen

    Keep position when rotating screen

    The center of the screen should not change when the screen is rotated. The image should never be clipped when rotating from portrait to landscape (zoom out) but rotating from landscape to portrait can clip (zoom in) to keep rotation idempotent.

    bug 
    opened by perlatus 0
  • Swapping images (for progressive enhancement)

    Swapping images (for progressive enhancement)

    In order to not have a black screen delay when loading network images, being able to provide a lower-res image and swapping it out for a full-res one would be ideal.

    enhancement 
    opened by perlatus 0
  • Missing elastic boundaries

    Missing elastic boundaries

    Boundaries should be elastic.

    • When you zoom in too far, it should let you—but then shrink back to the smallest zoom size.
    • When you zoom out too far, it should let you—but then grow to fill the screen.
    • When you pan past the boundaries, it should let you—but then pan until the viewport boundaries are back.
    • ...

    Probably depends on #1.

    Should have a delay so that it only animates when not between pinch-zooms.

    enhancement 
    opened by perlatus 1
Owner
null
Caffodils - Download everything | Flutter app for Android and IOS. Download Video, Reels, Shorts, Music, Images, Files from Instagram, Facebook and Youtube

caffodils Caffodils - Download everything Flutter app for Android and IOS. Download Video, Reels, Shorts, Music, Images, Files from Instagram, Faceboo

Caffodils 11 Oct 24, 2022
A chatting app made with Flutter and FireBase. It supports GIPHY gifs, images, stcikers, dark mode, custom animations, google login, online storage, beautiful UI and more.

ChatMe A Flutter based chatting app which lets user chat from random peoples or strangers, has GIPHY gif support, sitckers, custom animations, dark mo

Hash Studios 20 Nov 7, 2022
A sample application that allows a user to upload and share images, made with Flutter and Firebase

FlutterFire Gallery A sample Flutter app to upload images and share them via lin

Mais Alheraki 9 Oct 29, 2022
A social media app where people can post images, follow users ,chat with other users and much more.

Nallagram A Social media app (Both frontend and backend) created with Flutter and Firebase.(inspired from instagram) Show some ❤️ and star ⭐ the repo

Pranav Ajay 34 Jan 6, 2023
Images gathered by NASA's Curiosity, Opportunity, and Spirit rovers on Mars.

Eye of rover This app includes image data gathered by NASA's Curiosity, Opportunity, and Spirit rovers on Mars with given filters (Sol and Camera). Lo

İbrahim Mert Gül 1 Jan 6, 2022
Mobile app to square images by adding padding around it.

Resizrr Mobile app to crop images. Screens ?? How to set-up this project on local machine? Fork this project Then clone the forked project by git clon

Aman Kumar 9 Oct 23, 2022
We are building an open database of COVID-19 cases with chest X-ray or CT images.

?? Note: please do not claim diagnostic performance of a model without a clinical study! This is not a kaggle competition dataset. Please read this pa

Joseph Paul Cohen 2.9k Jan 7, 2023
Dart library with stack blur algorithm for RGBA images

stack_blur The Dart library for blurring images with the Stack blur algorithm. T

Artёm IG 3 Nov 19, 2022
App to seamlessly share files/images from your phone to your pc

Self-Share App to seamlessly share files/images from your phone to your pc Image

Wahbi 1 May 28, 2022
A Flutter plugin for handling Connectivity and REAL Connection state in the mobile, web and desktop platforms. Supports iOS, Android, Web, Windows, Linux and macOS.

cross_connectivity A Flutter plugin for handling Connectivity and REAL Connection state in the mobile, web and desktop platforms. Supports iOS, Androi

MarchDev Toolkit 29 Nov 15, 2022
A Flutter plugin to retrieve and manage contacts on Android and iOS devices. Maintainer: @lukasgit

contacts_service A Flutter plugin to access and manage the device's contacts. Usage To use this plugin, add contacts_service as a dependency in your p

Lukas Dickie 166 Dec 28, 2022
This plugin allows Flutter desktop apps to resizing and repositioning the window.

window_manager This plugin allows Flutter desktop apps to resizing and repositioning the window. window_manager Platform Support Quick Start Installat

LeanFlutter 346 Jan 3, 2023
A Flutter plugin that supports Pangle SDK on Android and iOS.

Thanks for non-commercial open source development authorization by JetBrains. 穿山甲 Flutter SDK `pangle_flutter`是一款集成了字节跳动穿山甲 Android 和 iOS SDK的 Flutter

null 121 Dec 2, 2022
Playify is a Flutter plugin for play/pause/seek songs, fetching music metadata, and browsing music library.

Playify Playify is a Flutter plugin for play/pause/seek songs, fetching music metadata, and browsing music library. Playify was built using iOS's Medi

Ibrahim Berat Kaya 32 Dec 14, 2022
A robust Flutter plugin for making payments via Paystack Payment Gateway. Completely supports Android and iOS

?? Paystack Plugin for Flutter A Flutter plugin for making payments via Paystack Payment Gateway. Fully supports Android and iOS. ?? Installation To u

Wilberforce Uwadiegwu 165 Jan 4, 2023
A Flutter plugin for playing music on iOS and Android.

Stereo plugin for Flutter A Flutter plugin for playing music on iOS and Android. Features Play/pause Stop Duration / seek to position Load track from

2find 67 Sep 24, 2022
A flutter plugin for integrating razorpay payment gateway. Supports Android and iOS.

Flutter Razorpay Plugin A flutter plugin for razorpay integration for both android and ios. If you use this library in your app, please let me know an

Chetan Kaushik 28 Dec 13, 2022
A flutter IM plugin for android and ios

flutter_openim_sdk Download demo flutter_openim_widget A flutter IM plugin for android and ios. Getting Started 1,Add dependency in yaml flutter_op

kostia7alania 1 Dec 3, 2021
A Flutter plugin for Yandex AppMetrica SDK, a marketing platform for app install attribution, app analytics, and push campaigns.

appmetrica_sdk A Flutter plugin for Yandex AppMetrica SDK. Plugin implementation status Implemented Events Profiles Not implemented yet Revenue. Comin

EM ALL iT Studio 15 Oct 21, 2021