icached_network_image 0.0.2 copy "icached_network_image: ^0.0.2" to clipboard
icached_network_image: ^0.0.2 copied to clipboard

An advanced cached network image with handling

icached_network_image #

A Flutter widget for displaying network images with efficient caching.

This package provides a convenient way to display network images in your Flutter applications while taking advantage of caching to improve performance and reduce data usage.

Installation #

  1. Add the following dependency to your pubspec.yaml file:

    dependencies:
      icached_network_image: ^1.0.0 (or latest version)
    
  2. Run flutter pub get to install the package.

Usage #

Import the package in your Dart code:

import 'package:icached_network_image/icached_network_image.dart';

Use the ICachedNetworkImage widget to display your network images:

ICachedNetworkImage(
  'https://example.com/image.jpg',
  height: 100,
  width: 150,
  placeholderAssetImage: 'assets/placeholder.png',
  fit: BoxFit.cover,
),

Features #

  • Caches downloaded images for faster loading in subsequent uses.
  • Provides a placeholder image to display while the network image is loading.
  • Supports local file paths for placeholder images.
  • Allows customization of the image container's shape (rectangle, circle) and border.
  • Offers flexibility in specifying image dimensions (height, width) and fit within the container.
  • Handles checking and updating cached images to ensure they stay fresh.

Optional Parameters #

  • height: Controls the height of the image container (defaults to 50).
  • width: Controls the width of the image container (defaults to 50).
  • placeholderAssetImage: The asset path of the placeholder image.
  • fit: The fit of the image within its container (defaults to BoxFit.cover). Can be any BoxFit value.
  • alwaysShowPlaceHolder: Set to true to always display the placeholder image, even when the network image is available (defaults to false).
  • shape: The shape of the image container (defaults to BoxShape.circle). Can be BoxShape.rectangle or BoxShape.circle.
  • borderRadius: The border radius of the image container (defaults to null).
  • filePlaceholderPath: The local file path of an alternative placeholder image (optional).
  • border: The border of the image container (optional). Use a BoxBorder object to define the border style and color.

Contributing #

We welcome contributions to this package! Feel free to fork the repository on GitHub (https://github.com/MicroProgramer/icached_network_image), create pull requests for bug fixes or new features, and raise issues for any problems you encounter.

License #

This package is licensed under the MIT License.