cached_network_image_widget 1.0.0
cached_network_image_widget: ^1.0.0 copied to clipboard
A Flutter package providing advanced CachedNetworkImage and SVG image caching with BlurHash placeholders and shimmer effects.
πΌ Cached Network Image Widget #
The Cached Network Image Widget package provides a simple, customizable way to display network images and SVGs in your Flutter applications.
It supports image caching, blurhash placeholders, shimmer loading animations, and SVG color customization β all with minimal setup.
β¨ Features #
- π§ Smart Caching β Automatically caches network images and SVGs
- π BlurHash Placeholders β Show a blurred preview while loading
- β‘ Shimmer Loading β Smooth skeleton loading animation
- π¨ SVG Support β Load and color SVGs from URLs
- π§© Customizable Styles β Supports radius, borders, and shapes
- β Error Handling β Gracefully handle missing or broken images
βοΈ Installation #
Add cached_network_image_widget to your pubspec.yaml file:
dependencies:
cached_network_image_widget: ^1.0.0
Then run:
```bash
flutter pub get
Import the package:
import 'package:cached_network_image_widget/cached_network_image_widget.dart';
π Usage #
- Display a Cached Network Image
CachedNetworkImageWidget(
'https://picsum.photos/400/300',
height: 200,
width: 300,
borderRadius: BorderRadius.circular(12),
);
- Display a Cached SVG Image
CachedNetworkSvgWidget(
'https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/android.svg',
height: 100,
width: 100,
color: Colors.green,
);
- With BlurHash and Error Handling
CachedNetworkImageWidget(
'https://example.com/photo-BH_cE3gK-EVH_.jpg', // BlurHash in URL
height: 250,
width: double.infinity,
shape: BoxShape.rectangle,
border: Border.all(color: Colors.grey.shade300),
errorBuilder: (context, url, error) => const Icon(Icons.broken_image),
);
π§ Parameters #
| Parameter | Type | Description |
|---|---|---|
| imageUrl | String | Image URL to load |
| height | double? | Image height |
| width | double? | Image width |
| borderRadius | BorderRadius? | Rounded corners |
| border | BoxBorder? | Border style |
| fit | BoxFit | How the image fits (default: BoxFit.cover) |
| shape | BoxShape | Shape (rectangle or circle) |
| color | Color? | Tint color (for SVGs) |
| errorBuilder | Widget Function(BuildContext, String, Object)? | Custom error widget |
π License #
π§ͺ Example App
You can find a working demo inside the example/ folder.
Run it directly:
cd example
flutter run
πͺͺ License
This project is licensed under the MIT License.
Β© 2025 Safeen Kurd
π€ Author
Safeen Kurd
π§ safeenkurd96@gmail.com
π void.krd β safeenkurd.info