scalable_image 1.1.1

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

scalable_image

A widget that shows an image which can be scaled and dragged using gestures. This package was designed for quadratic images. It can happen that it don't behave as you expect for non quadratic images. A workaround is to wrap this image in an AspectRatio with an aspect ratio of the target image. This has the drawback that it does not fill the whole space while zooming since it will contain the aspect ratio. Feel free to fork on github.

Getting Started

You can also try using an other ImageProvider, like NetworkImage and FileImage.

new ScalableImage(
          imageProvider: new AssetImage('assets/example.png'),
          dragSpeed: 4.0,
          maxScale: 16.0
        )

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

demo!

[1.1.1] - 25.04.2018

  • Added type (ImageProvider) to imageProvider in scalable_image.dart
  • Fixed library name

[1.1.0] - 25.04.2018

  • Added an option which allows to wrap the image in an AspectRatio
  • Added an option to lock scaling

[1.0.0] - 20.04.2018

  • Initial release

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:scalable_image/scalable_image.dart';

void main() {
  runApp(new MaterialApp(
      theme: new ThemeData(
          brightness: Brightness.dark,
          primarySwatch: Colors.green
      ),
      title: 'Scalable Image Example',
      home: new MainPage()
  ));
}
class MainPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(
        title: const Text('Scalable Image Example'),
        centerTitle: true,
      ),
      body: new Container(
        alignment: Alignment.center,
        child: new ScalableImage(
          imageProvider: new AssetImage('assets/example.png'),
          dragSpeed: 4.0,
          maxScale: 16.0,
          wrapInAspect: false,
          enableScaling: true,
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  scalable_image: "^1.1.1"

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:scalable_image/scalable_image.dart';
  
Version Uploaded Documentation Archive
1.1.1 Apr 25, 2018 Go to the documentation of scalable_image 1.1.1 Download scalable_image 1.1.1 archive
1.1.0 Apr 25, 2018 Go to the documentation of scalable_image 1.1.0 Download scalable_image 1.1.0 archive
1.0.0 Apr 20, 2018 Go to the documentation of scalable_image 1.0.0 Download scalable_image 1.0.0 archive

Analysis

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

  • Dart: 2.0.0-dev.54.0
  • pana: 0.11.1
  • Flutter: 0.4.4

Scores

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

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Suggestions

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 2 hints.

    Run flutter format to format lib/scalable_image.dart.

    Run flutter format to format lib/src/scalable_image.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.28.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.6 1.14.9
meta 1.1.5
sky_engine 0.0.99
typed_data 1.1.5
vector_math 2.0.6 2.0.7