Giter VIP home page Giter VIP logo

pinch_zoom_image's Introduction

Pinch Zoom Image

A widget that makes picture pinch zoom, Instagram style!

Example one Example two

Installation

Add this to your pubspec.yml dependencies:

pinch_zoom_image: "^0.2.5"

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!

pinch_zoom_image's People

Contributors

youssefkababe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

pinch_zoom_image's Issues

Kotlin Gradle plugin version build error

Hey,
I'm trying your plugin, but when I compiled my app.
Build crashed with this exception:

The Android Gradle plugin supports only Kotlin Gradle plugin version 1.3.10 and higher.
The following dependencies do not satisfy the required version:
project ':pinch_zoom_image' -> org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.71

Remove native portion

Is it possible to remove the native code portion altogether and use Flutters SystemChrome methods?

Besides, the Kotlin version is out of date again:

The Android Gradle plugin supports only Kotlin Gradle plugin version 1.3.0 and higher.
The following dependencies do not satisfy the required version:
project ':pinch_zoom_image' -> org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.71

Highly suggest to move this back to Java..

Update kotlin version

Hi there,
Please upload a simple update and upgrade your Kotlin version so we can all enjoy the latest gradle plugin.
Love your library!!!
Thanks!

Build failed in release mode

FAILURE: Build failed with an exception.

  • What went wrong:
    A problem occurred configuring root project 'pinch_zoom_image'.

The SDK directory 'C:\flutter.pub-cache\hosted\pub.dartlang.org\pinch_zoom_image_updated-0.2.6\android\Users\youssef\Library\Android\sdk' does not exist.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 1s

Finished with error: The plugin pinch_zoom_image_updated could not be built due to the issue above.

Issue running on iOS simulator,

pinch_zoom_image: "^0.2.5"

console output

    Downloading dependencies

    -> Installing Flutter (1.0.0)

    -> Installing path_provider (0.0.1)

    -> Installing pinch_zoom_image (0.0.1)

    -> Installing shared_preferences (0.0.1)
      - Running pre install hooks
    [!] Unable to determine Swift version for the following pods:

    - `pinch_zoom_image` does not specify a Swift version and none of the targets (`Runner`) integrating it have the `SWIFT_VERSION` attribute
    set. Please contact the author or set the `SWIFT_VERSION` attribute in at least one of the targets that integrate this pod.

    /usr/local/Cellar/cocoapods/1.6.0/libexec/gems/cocoapods-1.6.0/lib/cocoapods/installer/xcode/target_validator.rb:115:in
    `verify_swift_pods_swift_version'
    /usr/local/Cellar/cocoapods/1.6.0/libexec/gems/cocoapods-1.6.0/lib/cocoapods/installer/xcode/target_validator.rb:37:in `validate!'
    /usr/local/Cellar/cocoapods/1.6.0/libexec/gems/cocoapods-1.6.0/lib/cocoapods/installer.rb:459:in `validate_targets'
    /usr/local/Cellar/cocoapods/1.6.0/libexec/gems/cocoapods-1.6.0/lib/cocoapods/installer.rb:138:in `install!'
    /usr/local/Cellar/cocoapods/1.6.0/libexec/gems/cocoapods-1.6.0/lib/cocoapods/command/install.rb:48:in `run'
    /usr/local/Cellar/cocoapods/1.6.0/libexec/gems/claide-1.0.2/lib/claide/command.rb:334:in `run'
    /usr/local/Cellar/cocoapods/1.6.0/libexec/gems/cocoapods-1.6.0/lib/cocoapods/command.rb:52:in `run'
    /usr/local/Cellar/cocoapods/1.6.0/libexec/gems/cocoapods-1.6.0/bin/pod:55:in `<top (required)>'
    /usr/local/Cellar/cocoapods/1.6.0/libexec/bin/pod:22:in `load'
    /usr/local/Cellar/cocoapods/1.6.0/libexec/bin/pod:22:in `<main>'

Error Kotlin Gradle plugin version

Hello.

The Android Gradle plugin supports only Kotlin Gradle plugin version 1.2.51 and higher. Project 'pinch_zoom_image' is using version 1.2.30.

Please, upgrade package to Flutter v0.9.4.
Thanks

AndroidX compatibility

I wanted to know if this library is androidx compatible or not because it is breaking the build.

Android resource linking failed

pinch_zoom_image: ^0.2.5

Execution failed for task ':pinch_zoom_image:verifyReleaseResources'.

java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
---/build/pinch_zoom_image/intermediates/res/merged/release/values/values.xml:236: error: resource android:attr/fontVariationSettings not found.
---/build/pinch_zoom_image/intermediates/res/merged/release/values/values.xml:237: error: resource android:attr/ttcIndex not found.
error: failed linking references.

pinch_zoom_image_updated does not work on iOS

pinch_zoom_image_updated work fine in android but the plugin does not work for iOS. Here is the error I get if I try to run in iOS

[!] No podspec found for pinch_zoom_image_updated in .symlinks/plugins/pinch_zoom_image_updated/ios

any solution?

Outdated kotlin version

Latest stable Kotlin version is 1.3.50, but this library still use 1.2.70

please update to latest version

How to make zoom center as the focalPoint?

At this moment, When I zoom in the image, it just zooms in, and the zoom center is the center of the image.Can we make center of our two fingers(see focalPoint) as the zoom center.

Just as Instagrm, when we zoom in the image only(DO NOT scale), the overlay image will also change it's position to make out finger cenrer of the screen.

No pod spec iOS

[!] No podspec found for `pinch_zoom_image_updated` in `.symlinks/plugins/pinch_zoom_image_updated/ios`

`pinch_zoom_image` does not specify a Swift version

pinch_zoom_image: "^0.2.5"

console output

Downloading dependencies

-> Installing Flutter (1.0.0)

-> Installing path_provider (0.0.1)

-> Installing pinch_zoom_image (0.0.1)

-> Installing shared_preferences (0.0.1)
  - Running pre install hooks
[!] Unable to determine Swift version for the following pods:

- `pinch_zoom_image` does not specify a Swift version and none of the targets (`Runner`) integrating it have the `SWIFT_VERSION` attribute
set. Please contact the author or set the `SWIFT_VERSION` attribute in at least one of the targets that integrate this pod.

/usr/local/Cellar/cocoapods/1.6.0/libexec/gems/cocoapods-1.6.0/lib/cocoapods/installer/xcode/target_validator.rb:115:in
`verify_swift_pods_swift_version'
/usr/local/Cellar/cocoapods/1.6.0/libexec/gems/cocoapods-1.6.0/lib/cocoapods/installer/xcode/target_validator.rb:37:in `validate!'
/usr/local/Cellar/cocoapods/1.6.0/libexec/gems/cocoapods-1.6.0/lib/cocoapods/installer.rb:459:in `validate_targets'
/usr/local/Cellar/cocoapods/1.6.0/libexec/gems/cocoapods-1.6.0/lib/cocoapods/installer.rb:138:in `install!'
/usr/local/Cellar/cocoapods/1.6.0/libexec/gems/cocoapods-1.6.0/lib/cocoapods/command/install.rb:48:in `run'
/usr/local/Cellar/cocoapods/1.6.0/libexec/gems/claide-1.0.2/lib/claide/command.rb:334:in `run'
/usr/local/Cellar/cocoapods/1.6.0/libexec/gems/cocoapods-1.6.0/lib/cocoapods/command.rb:52:in `run'
/usr/local/Cellar/cocoapods/1.6.0/libexec/gems/cocoapods-1.6.0/bin/pod:55:in `<top (required)>'
/usr/local/Cellar/cocoapods/1.6.0/libexec/bin/pod:22:in `load'
/usr/local/Cellar/cocoapods/1.6.0/libexec/bin/pod:22:in `<main>'

cant uninstall

I tried the package but thing error arises. I cannot rectify it. Please help

The “Swift Language Version” (SWIFT_VERSION) build setting must be set to a supported value for targets which use Swift. Supported values are: 3.0, 4.0, 4.2. This setting can be set in the build settings editor.

ios simulator pinch_zoom_image

=== BUILD TARGET sqflite OF PROJECT Pods WITH CONFIGURATION Debug ===
/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/pinch_zoom_image-0.2.5/ios/Classes/SwiftPinchZoomImagePlugin.swift:13:55: error: 'UIWindowLevelStatusBar' has been renamed to 'UIWindow.Level.statusBar'
UIApplication.shared.keyWindow?.windowLevel = UIWindowLevelStatusBar
^~~~~~~~~~~~~~~~~~~~~~
UIWindow.Level.statusBar
UIKit.UIWindowLevelStatusBar:2:12: note: 'UIWindowLevelStatusBar' was obsoleted in Swift 3
public let UIWindowLevelStatusBar: UIWindow.Level
^
/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/pinch_zoom_image-0.2.5/ios/Classes/SwiftPinchZoomImagePlugin.swift:16:55: error: 'UIWindowLevelNormal' has been renamed to 'UIWindow.Level.normal'
UIApplication.shared.keyWindow?.windowLevel = UIWindowLevelNormal
^~~~~~~~~~~~~~~~~~~
UIWindow.Level.normal
UIKit.UIWindowLevelNormal:2:12: note: 'UIWindowLevelNormal' was obsoleted in Swift 3
public let UIWindowLevelNormal: UIWindow.Level

High resolution image zoom result in black screen

I am running the demo with one of my high resolution image. And I can see the image, even zoom it a little bit, but after I zoom it to certain ratio, it will black out, and when it zoom back, it will show the picture again. I think this is a bug.

Image:
high_resolution

Code:
`import 'package:flutter/material.dart';
import 'package:pinch_zoom_image/pinch_zoom_image.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:photo_view/photo_view.dart';

class PinchZoomImageDemo extends StatelessWidget {
@OverRide
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Pinch Zoom Image Demo'),
),
body: ListView(
children: [
PinchZoomImage(
image: CachedNetworkImage(
imageUrl: web_url_of_my_image',
),
zoomedBackgroundColor: Color.fromRGBO(240, 240, 240, 1.0),
),
],
),
);
}
}`

black background when zomed

When I zoom the image, the image backdroud is black. How can I change it, because I had set the zoomedBackgroundColor to white but don't work!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.