flutter_advanced_networkimage 0.3.9

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

Flutter Advanced Network Imageprovider

pub package

An advanced image provider provides caching and retrying for flutter app. Now with zoomable widget and transition to image widget.

Getting Started

Installation

Add this to your pubspec.yaml (or create it):

dependencies:
  flutter_advanced_networkimage: any

Then run the flutter tooling:

flutter packages get

Example

// using image provider
Image(
  image: AdvancedNetworkImage(url, header: header, useDiskCache: true),
  fit: BoxFit.cover,
)
// get the disk cache folder size
int folderSize = await getDiskCachedImagesSize();
// clean the disk cache
bool isSucceed = await clearDiskCachedImages();
// using zooming widget & transitiontoimage widget
ZoomableWidget(
  minScale: 0.3,
  maxScale: 2.0,
  // default factor is 1.0, use 0.0 to disable boundary
  panLimit: 0.8,
  child: Container(
    child: TransitionToImage(
      AdvancedNetworkImage(url, timeoutDuration: Duration(minutes: 1)),
      // This is the default placeholder widget at loading status,
      // you can write your own widget with CustomPainter.
      placeholder: CircularProgressIndicator(),
      // This is default duration
      duration: Duration(milliseconds: 300),
    ),
  ),
)
// Reload feature included
TransitionToImage(
  AdvancedNetworkImage(url,
    loadedCallback: () {
      print('It works!');
    },
    loadFailedCallback: () {
      print('Oh, no!');
    }),
  loadingWidget: const CircularProgressIndicator(),
  fit: BoxFit.contain,
  placeholder: const Icon(Icons.refresh),
  width: 400.0,
  height: 300.0,
);
// Scale the widget size. (Origin point was fixed to screen's center)
ZoomableWidget(
  panLimit: 1.0,
  maxScale: 2.0,
  minScale: 0.5,
  singleFingerPan: true,
  multiFingersPan: true,
  child: Image(
    image: AssetImage('graphics/background.png'),
  ),
  zoomSteps: 3,
),

Details in example/ folder.

demo gif

Changelog

[0.3.9]

  • Update http dependency.
  • Catch the bad images from remote

[0.3.8]

  • Check if _imageInfo is null.

[0.3.7]

  • Give the cache file path.
  • Fix TransitionToImage BoxFit behaves.
  • Better impl on retry feature.
  • Remove quiver dependency.

[0.3.6]

  • Add fallbackImage in AdvancedNetworkImage.
  • Fix bug on retryLimit.
  • Tweek the GestureDetector in TransitionToImage.

[0.3.5]

  • Add a flag to disable interior GestureDetector in TransitionToImage.
  • Fix bug on printing error.

[0.3.4]

  • Add callback on AdvancedNetworkImage.
  • Add a bounce back boundary.
  • Add double tap step zoom.

[0.3.3]

  • Move the ZoomableWidget's origin point to screen's center.

[0.3.2]

  • Add multiFingersPan and remove enablePan.

[0.3.1]

  • Now allow ZoomableWidget to pan with single finger.

[0.3.0+1]

  • Update README.md.

[0.3.0]

  • Add ZoomableList.

[0.2.11]

  • Update placeholder in TransitionToImage.

[0.2.10]

  • Add image fit option to TransitionToImage.

[0.2.9+1]

  • Change dependencies version.

[0.2.9]

  • Fix ConcurrentModificationError again.

[0.2.8]

  • ZoomableWidget support boundary for now.

[0.2.7]

  • Drop support for ETag checking.

[0.2.6]

  • Fix an issue that causes a ConcurrentModificationError.

[0.2.5]

  • Move the cache files from app folder to temporary folder.

[0.2.4]

  • Add reloadWidget and fallbackWidget to TransitionToImage widget.

[0.2.3]

  • Add a minimum png to avoid some issues.
  • Add a reload button to TransitionToImage widget to reload the image if fetching network image failed.

[0.2.2+1]

  • Update some dependencies.

[0.2.2]

  • Adapt to dart 2 preview.

[0.2.1]

  • Support fallback image after retrying failed.

[0.2.0+1]

  • Cleanup example code.

[0.2.0]

  • Add timeoutDuration parameter, make some tweaks and add some doc comments to AdvancedNetworkImage imageprovider.

  • Make some tweaks for TransitionToImage widget.

  • Fix the panning issue which would shift when the scale is not 1.0 for ZoomableWidget.

[0.1.10]

  • Catch exception for file not found.

[0.1.9]

  • Add default blendmode to TransitionToImage widget.

[0.1.8]

  • Fix the listener leak problem for the TransitionToImage widget.

[0.1.7]

  • Add a TransitionToImage Widget, optimize ZoomableWidget and update example.

[0.1.6+2]

  • Downgrade http version.

[0.1.6+1]

  • Upgrade the dart SDK version.

[0.1.6]

  • Add animation to ZoomableWidget.

[0.1.5]

  • Update ZoomableWidget.

[0.1.4]

  • Update example.

[0.1.3]

  • Fix dependencies with http package.

[0.1.2]

  • Upgrade some dependencies version.

[0.1.1]

  • Downgrade some packages version.

[0.1.0]

  • An advanced image provider and a widget with zooming and panning.

example/lib/main.dart

import 'dart:typed_data';

import 'package:flutter/material.dart';

import 'package:flutter_advanced_networkimage/flutter_advanced_networkimage.dart';
import 'package:flutter_advanced_networkimage/transition_to_image.dart';
import 'package:flutter_advanced_networkimage/zoomable_widget.dart';
import 'package:flutter_advanced_networkimage/zoomable_list.dart';
import 'package:flutter_advanced_networkimage/image_cropper.dart';

main() => runApp(MaterialApp(
      title: 'Flutter Example',
      theme: ThemeData(primaryColor: Colors.blue),
      home: MyApp(),
    ));

class MyApp extends StatefulWidget {
  @override
  State<StatefulWidget> createState() => Example();
}

class Example extends State<MyApp> {
  ByteData imageCropperData;
  ValueChanged<ByteData> onImageCropperChanged;

  cropImage(ByteData data) => setState(() => imageCropperData = data);

  @override
  Widget build(BuildContext context) {
    return DefaultTabController(
        length: 4,
        child: Scaffold(
          appBar: AppBar(
            title: Text('Flutter Advanced Network Image Example'),
            bottom: TabBar(
              tabs: <Widget>[
                Tab(text: 'load image'),
                Tab(text: 'zooming'),
                Tab(text: 'widget list'),
                Tab(text: 'crop image(WIP)'),
                // Tab(text: 'cropped image'),
              ],
            ),
          ),
          body: TabBarView(
            physics: NeverScrollableScrollPhysics(),
            children: <Widget>[
              TransitionToImage(
                AdvancedNetworkImage(
                  'https://assets-cdn.github.com/images/modules/logos_page/GitHub-Mark.png',
                  loadedCallback: () => print('It works!'),
                  loadFailedCallback: () => print('Oh, no!'),
                ),
                fit: BoxFit.contain,
                placeholder: const Icon(Icons.refresh),
                width: 300.0,
                height: 300.0,
              ),
              ZoomableWidget(
                panLimit: 0.7,
                maxScale: 2.0,
                minScale: 0.5,
                multiFingersPan: false,
                child: Image(
                  image: AdvancedNetworkImage(
                    'https://assets-cdn.github.com/images/modules/logos_page/GitHub-Mark.png',
                  ),
                ),
              ),
              Builder(builder: (BuildContext context) {
                GlobalKey _key = GlobalKey();
                return ZoomableList(
                  childKey: _key,
                  panLimit: 1.0,
                  maxScale: 2.0,
                  minScale: 0.5,
                  child: Column(
                    key: _key,
                    mainAxisSize: MainAxisSize.min,
                    children: <Widget>[
                      Image(
                        image: AdvancedNetworkImage(
                          'https://assets-cdn.github.com/images/modules/logos_page/GitHub-Mark.png',
                        ),
                      ),
                      Image(
                        image: AdvancedNetworkImage(
                          'https://assets-cdn.github.com/images/modules/logos_page/GitHub-Mark.png',
                        ),
                      ),
                      Image(
                        image: AdvancedNetworkImage(
                          'https://assets-cdn.github.com/images/modules/logos_page/GitHub-Mark.png',
                        ),
                      ),
                    ],
                  ),
                );
              }),
              ImageCropper(
                AdvancedNetworkImage(
                  'https://assets-cdn.github.com/images/modules/logos_page/GitHub-Mark.png',
                ),
                onImageCropperChanged: cropImage,
              ),
              // Container(
              //   color: Colors.limeAccent,
              //   child: imageCropperData != null
              //       ? Image.memory(
              //           Uint8List.view(imageCropperData.buffer),
              //           fit: BoxFit.contain,
              //         )
              //       : Container(),
              // ),
            ],
          ),
        ),
      );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  flutter_advanced_networkimage: ^0.3.9

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:flutter_advanced_networkimage/flutter_advanced_networkimage.dart';
  
Version Uploaded Documentation Archive
0.3.9 Oct 4, 2018 Go to the documentation of flutter_advanced_networkimage 0.3.9 Download flutter_advanced_networkimage 0.3.9 archive
0.3.8 Sep 3, 2018 Go to the documentation of flutter_advanced_networkimage 0.3.8 Download flutter_advanced_networkimage 0.3.8 archive
0.3.7 Sep 3, 2018 Go to the documentation of flutter_advanced_networkimage 0.3.7 Download flutter_advanced_networkimage 0.3.7 archive
0.3.6 Aug 17, 2018 Go to the documentation of flutter_advanced_networkimage 0.3.6 Download flutter_advanced_networkimage 0.3.6 archive
0.3.5 Aug 15, 2018 Go to the documentation of flutter_advanced_networkimage 0.3.5 Download flutter_advanced_networkimage 0.3.5 archive
0.3.4 Aug 9, 2018 Go to the documentation of flutter_advanced_networkimage 0.3.4 Download flutter_advanced_networkimage 0.3.4 archive
0.3.3 Aug 5, 2018 Go to the documentation of flutter_advanced_networkimage 0.3.3 Download flutter_advanced_networkimage 0.3.3 archive
0.3.2 Aug 4, 2018 Go to the documentation of flutter_advanced_networkimage 0.3.2 Download flutter_advanced_networkimage 0.3.2 archive
0.3.1 Aug 4, 2018 Go to the documentation of flutter_advanced_networkimage 0.3.1 Download flutter_advanced_networkimage 0.3.1 archive
0.3.0+1 Jul 31, 2018 Go to the documentation of flutter_advanced_networkimage 0.3.0+1 Download flutter_advanced_networkimage 0.3.0+1 archive

All 39 versions...

Popularity:
Describes how popular the package is relative to other packages. [more]
93
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]
97
Learn more about scoring.

We analyzed this package on Oct 10, 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.28.0 <3.0.0
collection ^1.14.0 1.14.11
crypto ^2.0.5 2.0.6
flutter 0.0.0
http ^0.12.0 0.12.0
path ^1.6.0 1.6.2
path_provider ^0.4.1 0.4.1
Transitive dependencies
async 2.0.8
charcode 1.1.2
convert 2.0.2
http_parser 3.1.3
meta 1.1.6
sky_engine 0.0.99
source_span 1.4.1
string_scanner 1.0.4
typed_data 1.1.6
vector_math 2.0.8