imagex_flutter 0.0.1
imagex_flutter: ^0.0.1 copied to clipboard
A reusable Flutter image widget for asset, network, SVG, and file images.
ImageX Flutter #
A reusable Flutter image widget that simplifies handling different image sources (Asset, Network, SVG, and File) with built-in support for caching, placeholders, error widgets, and border radius.
Features #
- Multi-source Support: Seamlessly switch between Asset, Network, File, and SVG.
- Auto-detection: Automatically detects image type based on the path (URL, file path, or asset path).
- SVG Support: Built-in SVG rendering for all sources.
- Caching: Uses
cached_network_imagefor efficient network image loading and caching. - Easy Styling: Apply
borderRadius,fit,width,height, andcolorFilter(for SVGs) easily. - Customizable: Provide custom
placeholderanderrorWidget.
Getting started #
Add imagex_flutter to your pubspec.yaml:
dependencies:
imagex_flutter: ^0.0.1
Then run:
flutter pub get
Usage #
Simple Usage (Auto-detection) #
import 'package:imagex_flutter/imagex_flutter.dart';
// Network Image
ImageX(path: 'https://example.com/image.png')
// Asset Image
ImageX(path: 'assets/images/logo.png')
// SVG Image (Asset)
ImageX(path: 'assets/images/icon.svg')
Advanced Usage #
ImageX(
path: 'https://example.com/image.png',
width: 100,
height: 100,
borderRadius: 12.0,
fit: BoxFit.cover,
placeholder: CircularProgressIndicator(),
errorWidget: Icon(Icons.error),
)
SVG with Color Filter #
ImageX(
path: 'assets/icons/home.svg',
svgColor: ColorFilter.mode(Colors.blue, BlendMode.srcIn),
)
Full-screen Image Viewer #
ImageX has a built-in image viewer. You can enable it by setting useImageViewer: true.
// Single image viewer
ImageX(
path: 'https://example.com/image.png',
useImageViewer: true,
)
// Gallery (multiple images)
ImageX(
path: 'https://example.com/image1.png',
useImageViewer: true,
imageList: [
'https://example.com/image1.png',
'https://example.com/image2.png',
'https://example.com/image3.png',
],
)
Additional information #
For issues or contributions, please visit the repository.