MultiTypeImageLoader

A Flutter package to load and display images from various sources including asset files, network links, memory, files, SVGs, and Lottie animations, with support for directional flipping based on text direction.

Features

  • Load images from different sources:
    • Assets
    • Network links
    • Memory
    • Files
    • SVG
    • Lottie animations
  • Support for directional flipping based on text direction (RTL/LTR).
  • Customizable image properties like height, width, fit, and more.
  • Optional tap handling with onTap callback.
  • Customizable error widget for handling image load failures.

Installation

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

dependencies:
  multi_type_image_loader: ^1.0.0
  • Then, install the package using the following command: -flutter pub get

Usage

Import it

  import 'package:multi_type_image_loader/multi_type_image_loader.dart';

Parameters

  • image: The image source (String for asset/link/file, Uint8List for memory).
  • imageType: The type of image source (Asset, Link, Memory, File, SVG, Lottie).
  • fit: How the image should be inscribed into the space allocated for it.
  • height, width: The height and width of the image.
  • imageBytes: The bytes of the image when imageType is ImageType.memory.
  • onTap: Callback function to handle taps on the image.
  • isDirectionRequired: Flag to indicate whether directional flipping is required. (defaults to true)
  • errorWidget: Widget to display in case of image load failure.

Example Usage

   DirectionImage(
      image: 'path/to/image.jpg', 
      imageType: ImageType.asset,
      fit: BoxFit.cover,
      onTap: () => print('Image tapped!'),
      errorWidget: Icon(Icons.error),
    ),
DirectionImage(
  image: '[invalid URL removed]',
  imageType: ImageType.link,
  height: 200,
  width: 300,
),