progressive_image 1.0.0

  • Readme
  • Changelog
  • Example
  • Installing
  • new65

Progressive Image #

A flutter widget which progressively loads larger images using Low Quality Image Placeholders.

Snapshots #

Features #

  • Displays placeholder and thumbnail image until the target Image loads.
  • Smooth Fade-in animations for preventing immediate image popups on load.
  • Blur effect for low resolution thumbnail to prevent the pixelated view.
  • Effectively resolves thumbnail image before the target image starts to fetch for quick first impression.

Installing #

Following steps will help you add this library as a dependency in your flutter project.

  • In the pubspec.yaml file in the root of your project
dependencies:
    progressive_image: ^1.0.0 
  • Run the following command to get packages:
$ flutter packages get
  • Import the package in your project file:
import 'package:progressive_image/progressive_image.dart';

Usage #

For a more detailed look at how to use this library, there is a sweet project in the example directory and various examples can be found here

A simple example usage of the ProgressiveImage widget is shown below:

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

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

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: Text('Progressive Image Example')),
        body: ProgressiveImageExample(),
      ),
    );
  }
}

class ProgressiveImageExample extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
        return Container(
            child: ProgressiveImage(
                placeholder: AssetImage('assets/placeholder.jpg'),
                // size: 1.87KB 
                thumbnail: NetworkImage('https://i.imgur.com/7XL923M.jpg'), 
                // size: 1.29MB 
                image: NetworkImage('https://i.imgur.com/xVS07vQ.jpg'),     
                height: 300,
                width: 500,
            ),
        );
    }
}

[1.0.0]

  • Created flutter widget which progressively loads larger images using Low Quality Image Placeholders.
  • Displays Placeholder and Thumbnail image until the Original image loads.
  • Smooth Fade-in animations for preventing immediate image popups on load.
  • Blur effect for low resolution thumbnails to prevent the pixelated view.
  • Effectively resolves Thumbnail images before the Original image starts to fetch for quick first impression.

example/README.md

Progressive Image Demo #

Examples #

ProgressiveImage constructor

This requires ImageProvider as an argument for each of the placeholder, thumbnail and image parameters.

Note - image will start to load only after the thumbnail is resolved completely.

Widget example1 = ProgressiveImage(
    placeholder: AssetImage('assets/images/placeholder.jpg'),   // @required
    thumbnail: NetworkImage('https://i.imgur.com/eOQL4jg.jpg'), // @required
    image: NetworkImage('https://i.imgur.com/mDQ3Qbi.jpg'),     // @required
    height: 300,                                                // @required
    width: 500,                                                 // @required
    fit: BoxFit.cover,                                          // default BoxFit.fill
);

ProgressiveImage.assetNetwork constructor

Creates a widget that uses a placeholder image stored in an asset bundle while loading the thumbnail and target image from the network.

Widget example2 = ProgressiveImage.assetNetwork(
    placeholder: 'assets/images/placeholder.gif', // gifs can be used
    thumbnail: 'https://i.imgur.com/7XL923M.jpg',
    image: 'https://i.imgur.com/xVS07vQ.jpg',
    height: 250,
    width: 500,
    fit: BoxFit.cover,
);

ProgressiveImage.memoryNetwork constructor

Creates a widget that uses a placeholder image stored in memory while loading the thumbnail and target image from the network.

Widget example3 = ProgressiveImage.memoryNetwork(
    // see transparent_image package for kTransparentImage usage
    placeholder: kTransparentImage, 
    thumbnail: 'https://i.imgur.com/vz6P3pD.jpg',
    image: 'https://i.imgur.com/GL54OhH.jpg',
    height: 250,
    width: 500,
);

Use this package as a library

1. Depend on it

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


dependencies:
  progressive_image: ^1.0.0

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

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

3. Import it

Now in your Dart code, you can use:


import 'package:progressive_image/progressive_image.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
30
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]
65
Learn more about scoring.

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

  • Dart: 2.5.1
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.4

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test