photo_view 0.1.0

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

Flutter Photo View

Build Status - Travis Pub [![Join the chat at https://gitter.im/photo_view/Lobby](https://badges.gitter.im/photo_view/Lobby.svg)](https://gitter.im/photo_view/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

A simple zoomable image widget for Flutter

Resolves a image provider and shows the result with useful gestures support, such as pinch to zoom and pan.

It also can show any widget instead of an image, such as Container, Text or a SVG.

Installation

Add photo_view as a dependency in your pubspec.yaml file (what?).

Import Photo View:

import 'package:photo_view/photo_view.dart';

Docs & API

For more information about how to use Photo View, check the API Docs

If you want to see it in practice, check the example app that explores most of Photo View's use cases or download the latest version apk on the releases page

Usage

Given a ImageProvider imageProvider (such as AssetImage or NetworkImage):

@override
Widget build(BuildContext context) {
  return Container(
    child: PhotoView(
      imageProvider: AssetImage("assets/large-image.jpg"),
    )
  );
}

Result:

In action

Inline Usage

PhotoView can be used inside a container with size different than the screen.

The previous class PhotoViewInline has been deprecated and will be removed in future releases, use PhotoView instead

@override
Widget build(BuildContext context) {
  return Container(
    margin: const EdgeInsets.symmetric(vertical: 20.0),
    height: 300.0,
    child: PhotoView(
      imageProvider: AssetImage("assets/large-image.jpg"),
    )
  );
}

Result:

In action

Note: If you don't want to the zoomed image do not overlaps the size of the container, use ClipRect

To show several images and let user change between them, use PhotoViewGallery.

import 'package:photo_view/photo_view.dart';
import 'package:photo_view/photo_view_gallery.dart';
// ...

@override
Widget build(BuildContext context) {
  return Container(
    child: PhotoViewGallery(
      pageOptions: <PhotoViewGalleryPageOptions>[
        PhotoViewGalleryPageOptions(
          imageProvider: AssetImage("assets/gallery1.jpeg"),
          heroTag: "tag1",
        ),
        PhotoViewGalleryPageOptions(
          imageProvider: AssetImage("assets/gallery2.jpeg"),
          heroTag: "tag2",
          maxScale: PhotoViewComputedScale.contained * 0.3
        ),
        PhotoViewGalleryPageOptions(
          imageProvider: AssetImage("assets/gallery3.jpeg"),
          initialScale: PhotoViewComputedScale.contained * 0.98,
          heroTag: "tag3",
        ),
      ],
      backgroundColor: Colors.black87,
    )
  );
}

Result (with a simple HUD):

In action

More screenshots

Small imageAnimated GIFLimited scaleHero animation
In actionIn actionIn actionIn action

CHANGELOG

See the releases page on github

example/README.md

example

A new Flutter project.

Getting Started

For help getting started with Flutter, view our online documentation.

Use this package as a library

1. Depend on it

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


dependencies:
  photo_view: ^0.1.0

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:photo_view/photo_view.dart';
  
Version Uploaded Documentation Archive
0.1.0 Nov 27, 2018 Go to the documentation of photo_view 0.1.0 Download photo_view 0.1.0 archive
0.0.11 Nov 18, 2018 Go to the documentation of photo_view 0.0.11 Download photo_view 0.0.11 archive
0.0.10 Oct 8, 2018 Go to the documentation of photo_view 0.0.10 Download photo_view 0.0.10 archive
0.0.9 Oct 6, 2018 Go to the documentation of photo_view 0.0.9 Download photo_view 0.0.9 archive
0.0.8 Sep 14, 2018 Go to the documentation of photo_view 0.0.8 Download photo_view 0.0.8 archive
0.0.7 Aug 23, 2018 Go to the documentation of photo_view 0.0.7 Download photo_view 0.0.7 archive
0.0.6 Aug 18, 2018 Go to the documentation of photo_view 0.0.6 Download photo_view 0.0.6 archive
0.0.5 Aug 13, 2018 Go to the documentation of photo_view 0.0.5 Download photo_view 0.0.5 archive
0.0.4 Aug 4, 2018 Go to the documentation of photo_view 0.0.4 Download photo_view 0.0.4 archive
0.0.3 Jul 18, 2018 Go to the documentation of photo_view 0.0.3 Download photo_view 0.0.3 archive

All 12 versions...

Popularity:
Describes how popular the package is relative to other packages. [more]
97
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
95
Learn more about scoring.

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

  • Dart: 2.1.0
  • pana: 0.12.7
  • Flutter: 1.0.0

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Maintenance suggestions

The description is too short. (-20 points)

Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
after_layout ^1.0.7 1.0.7
flutter 0.0.0
test ^1.5.1 1.5.1+1
Transitive dependencies
analyzer 0.34.0
args 1.5.1
async 2.0.8
boolean_selector 1.0.4
charcode 1.1.2
collection 1.14.11
convert 2.0.2
crypto 2.0.6
csslib 0.14.6
front_end 0.1.7
glob 1.1.7
html 0.13.3+3
http 0.12.0
http_multi_server 2.0.5
http_parser 3.1.3
io 0.3.3
js 0.6.1+1
json_rpc_2 2.0.9
kernel 0.3.7
logging 0.11.3+2
matcher 0.12.3+1 0.12.4
meta 1.1.6
mime 0.9.6+2
multi_server_socket 1.0.2
node_preamble 1.4.4
package_config 1.0.5
package_resolver 1.0.6
path 1.6.2
plugin 0.2.0+3
pool 1.3.6
pub_semver 1.4.2
shelf 0.7.3+3
shelf_packages_handler 1.0.4
shelf_static 0.2.8
shelf_web_socket 0.2.2+4
sky_engine 0.0.99
source_map_stack_trace 1.1.5
source_maps 0.10.8
source_span 1.4.1
stack_trace 1.9.3
stream_channel 1.6.8
string_scanner 1.0.4
term_glyph 1.0.1
test_api 0.2.1
test_core 0.2.0+1
typed_data 1.1.6
utf 0.9.0+5
vector_math 2.0.8
vm_service_client 0.2.6
watcher 0.9.7+10
web_socket_channel 1.0.9
yaml 2.1.15
Dev dependencies
flutter_test