https://github.com/mubashardev/icached_network_image
https://github.com/mubashardev/icached_network_image
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/mubashardev/icached_network_image
- Owner: mubashardev
- License: mit
- Created: 2024-04-26T07:56:32.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-04-26T08:13:07.000Z (about 1 year ago)
- Last Synced: 2025-01-22T18:30:01.519Z (4 months ago)
- Language: Dart
- Size: 13.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# 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:
```yaml
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:
```dart
import 'package:icached_network_image/icached_network_image.dart';
```Use the `ICachedNetworkImage` widget to display your network images:
```dart
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](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](https://opensource.org/license/mit).