image_fade 0.2.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 75

ImageFade #

Requires Flutter 1.6.7 or higher.

A widget for Flutter that displays a placeholder widget while a specified image loads, then cross-fades to the loaded image. Also handles progress and errors.

If image is changed, it will cross-fade to the new image once it is finished loading. Setting image to null will cross-fade back to the placeholder.

example image

You can set fadeDuration and fadeCurve, as well as most Image properties: width, height, fit, alignment, repeat, matchTextDirection, excludeFromSemantics and semanticLabel.

You can also specify a loadingBuilder that will display load progress any time a new image is loaded, and an errorBuilder that will display if an error occurs while loading an image.

Example #

See the example directory for a simple example.

Changelog #

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

[0.2.1] - 2019-09-02

Changed #

  • Now using FadeTransition instead of Opacity for better performance.

[0.2.0] - 2019-07-29

Added #

  • Support for error handling via errorBuilder

Changed #

  • placeholder now accepts a Widget instead of an ImageProvider.
  • previously loaded images are now faded out after the new image is faded in. Noticeable when a smaller image is loaded over a larger one.

Removed #

  • backgroundColor was removed. Use a placeholder with a color instead.

[0.1.0] - 2019-07-23

Added #

  • First release.


image_fade_example #

Demonstrates the core features of the ImageFade widget.

Pressing the > button sets the image property to a new NetworkImage (loading from WikiMedia Commons).

Pressing the x button sets image to null.

Pressing the /!\ button sets image to a non-existent image url, demonstrating an error.

Use this package as a library

1. Depend on it

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

  image_fade: ^0.2.1

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:image_fade/image_fade.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
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


Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Format lib/image_fade.dart.

Run flutter format to format lib/image_fade.dart.


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