photo_view 0.0.8

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

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

PhotoView is useful in full screen exibition cases.

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

Installation

Add photo_view as a dependency in your pubspec.yaml file.

Import Photo View:

import 'package:photo_view/photo_view.dart';

Sample code

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

@override
Widget build(BuildContext context) {
  return new Container(
    child: new PhotoView(
      imageProvider: AssetImage("assets/large-image.jpg"),
      minScale: PhotoViewComputedScale.contained * 0.8,
      maxScale: 4.0,
    );
  );
}

Inline Usage

If you want PhotoView to scale the image in container with size different than the screen, use PhotoViewInline instead.

@override
Widget build(BuildContext context) {
  return new Container(
    child: new PhotoViewInline(
      imageProvider: AssetImage("assets/large-image.jpg"),
      minScale: PhotoViewComputedScale.contained * 0.8,
      maxScale: 4.0,
    );
  );
}

API

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

Screenshots

Large imageSmall imageAnimated GIF
In actionIn actionIn action
Limited scaleInlineHero animation
In actionIn actionIn action

Todo:

  • [x] Scale on doubleTap
  • [x] Zoom when pinched
  • [x] Respect screen and image boundaries
  • [x] Center image when zooming out
  • [x] Add image zoom limits (minScale an maxScale)
  • [x] Add GIF support
  • [ ] Multiple image support (Gallery mode)
  • [ ] Rotate gesture rotates image (Work in progress)

Pull requests are welcome 😊.

CHANGELOG

See REleases page on github

example/lib/main.dart

import 'package:flutter/material.dart';
import './screens/home_screen.dart';

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

ThemeData theme =  ThemeData(
  primaryColor: Colors.black,
  backgroundColor: Colors.white10,
  fontFamily: 'PTSans',
);

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Photo View',
      theme: theme,
      home: Scaffold(
        body: HomeScreen(),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  photo_view: ^0.0.8

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.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
0.0.2 May 1, 2018 Go to the documentation of photo_view 0.0.2 Download photo_view 0.0.2 archive
0.0.1 May 1, 2018 Go to the documentation of photo_view 0.0.1 Download photo_view 0.0.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
95
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
70
Overall:
Weighted score of the above. [more]
92
Learn more about scoring.

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

  • Dart: 2.0.0
  • pana: 0.12.3
  • Flutter: 0.8.4

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Suggestions

The description is too short.

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

Package is pre-v0.1 release.

While there is nothing inherently wrong with versions of 0.0.*, it usually means that the author is still experimenting with the general direction of the API.

Format lib/photo_view.dart.

Run flutter format to format lib/photo_view.dart.

Format lib/photo_view_computed_scale.dart.

Run flutter format to format lib/photo_view_computed_scale.dart.

Format lib/photo_view_image_wrapper.dart.

Run flutter format to format lib/photo_view_image_wrapper.dart.

Fix additional 3 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/photo_view_scale_boundaries.dart (Run flutter format to format lib/photo_view_scale_boundaries.dart.)
  • lib/photo_view_scale_state.dart (Run flutter format to format lib/photo_view_scale_state.dart.)
  • lib/photo_view_utils.dart (Run flutter format to format lib/photo_view_utils.dart.)

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.19.0 <3.0.0
after_layout ^1.0.4 1.0.4
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
Dev dependencies
flutter_test