CustomImage

A Flutter widget for displaying images with support for both network and asset images, customizable placeholders, error widgets, and rounded corners.

Features

  • Supports network and asset images
  • Customizable height, width, and border radius
  • Placeholder widget for loading states
  • Error widget for failed image loads
  • Adjustable image fit modes

📲 Installation

Add the dependency to your pubspec.yaml:

dependencies:
  apptomate_custom_image: ^0.0.2

Usage

CustomImage(
imageUrl: "https://example.com/image.jpg",
height: 150.0,
width: 150.0,
borderRadius: 10.0,
fit: BoxFit.cover,
isNetworkImage: true,
placeHolder: Center(child: CircularProgressIndicator()),
errorWidget: Center(child: Icon(Icons.broken_image, color: Colors.red)),
)

Example with Asset Image

CustomImage(
imageUrl: "assets/images/sample.png",
height: 100.0,
width: 100.0,
isNetworkImage: false,
)

Properties

Property Type Description
imageUrl String The URL or asset path of the image.
height double The height of the image.
width double The width of the image.
borderRadius double The border radius of the image.
fit BoxFit The BoxFit mode for the image.
isNetworkImage bool Determines whether the image is from a network or an asset.
placeHolder Widget? Widget to display while loading the image.
errorWidget Widget? Widget to display if the image fails to load.