pinch_zoom_image 0.2.4

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • new78

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.4"

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!

[0.2.4] - Oct 12

  • Add onZoomStart and onZoomEnd events callbacks

[0.2.3] - Oct 12

  • Make package accept any widget as image (Make it easy to work with packages like cached_network_image)

[0.2.2] - Oct 11

  • Turn package into plugin
  • Hide and show status bar using native platform code

[0.1.1] - Sep 27

  • First release

example/lib/main.dart

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

void main() => runApp(new MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      title: 'Pinch Zoom Image',
      theme: new ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: Scaffold(
        appBar: AppBar(
          title: Text('Pinch Zoom Image'),
        ),
        body: ListView(
          children: <Widget>[
            Container(
              padding: EdgeInsets.all(16.0),
              child: PinchZoomImage(
                image: Image.asset('images/camel.jpg'),
                zoomedBackgroundColor: Color.fromRGBO(240, 240, 240, 1.0),
                hideStatusBarWhileZooming: true,
                onZoomStart: () {
                  print('Zoom started');
                },
                onZoomEnd: () {
                  print('Zoom finished');
                },
              ),
            ),
            Container(
              padding: EdgeInsets.all(16.0),
              child: PinchZoomImage(
                image: CachedNetworkImage(
                  imageUrl: 'https://i.imgur.com/tKg0XEb.jpg',
                ),
                zoomedBackgroundColor: Color.fromRGBO(240, 240, 240, 1.0),
              ),
            ),
          ],
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  pinch_zoom_image: ^0.2.4

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter packages get

Alternatively, your editor might support flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:pinch_zoom_image/pinch_zoom_image.dart';
  
Version Uploaded Documentation Archive
0.2.4 Oct 12, 2018 Go to the documentation of pinch_zoom_image 0.2.4 Download pinch_zoom_image 0.2.4 archive
0.2.3 Oct 12, 2018 Go to the documentation of pinch_zoom_image 0.2.3 Download pinch_zoom_image 0.2.3 archive
0.2.2 Oct 11, 2018 Go to the documentation of pinch_zoom_image 0.2.2 Download pinch_zoom_image 0.2.2 archive
0.2.1 Oct 11, 2018 Go to the documentation of pinch_zoom_image 0.2.1 Download pinch_zoom_image 0.2.1 archive
0.2.0 Oct 11, 2018 Go to the documentation of pinch_zoom_image 0.2.0 Download pinch_zoom_image 0.2.0 archive
0.1.1 Sep 27, 2018 Go to the documentation of pinch_zoom_image 0.1.1 Download pinch_zoom_image 0.1.1 archive
0.1.0 Sep 27, 2018 Go to the documentation of pinch_zoom_image 0.1.0 Download pinch_zoom_image 0.1.0 archive
0.0.2 Sep 27, 2018 Go to the documentation of pinch_zoom_image 0.0.2 Download pinch_zoom_image 0.0.2 archive
0.0.1 Sep 27, 2018 Go to the documentation of pinch_zoom_image 0.0.1 Download pinch_zoom_image 0.0.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
57
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
78
Learn more about scoring.

We analyzed this package on Oct 12, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0
  • pana: 0.12.4
  • Flutter: 0.9.5

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11
meta 1.1.6
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8