Last updated:
0 purchases
generic image
Generic Image for Flutter #
A versatile Flutter widget for displaying images of various formats including SVG, PNG, JPEG, and Network Image . With built-in functionalities for placeholders, error handling, and more, GenericImage streamlines the process of working with different image formats.
Video Demo #
Check out the video demonstration of the generic_image package.
Features #
Supports multiple image formats: SVG, PNG, JPEG.
Automatic format detection based on file extension.
Built-in placeholder and error widgets.
Cache support for network images.
Extensive customization through the SvgStyle class.
Installation #
1. Add the package to your pubspec.yaml: #
dependencies:
generic_image: ^0.1.0
copied to clipboard
2. Install the package: #
flutter pub get
copied to clipboard
Usage #
Basic Usage #
import 'package:generic_image/generic_image.dart';
GenericImage(
src: 'path_to_your_image/image.svg',
format: ImageFormat.svg,
)
copied to clipboard
Automatic Format Detection #
GenericImage(
src: 'path_to_your_image/image.svg',
format: ImageFormat.detectAutomatically,
)
copied to clipboard
Using Placeholders and Error Widgets #
GenericImage(
src: 'https://your_image_url/image.png',
format: ImageFormat.png,
placeholder: (context, url) => CircularProgressIndicator(),
errorWidget: (context, url, error) => Icon(Icons.error),
)
copied to clipboard
SVG Styling #
Utilize the SvgStyle class for extensive styling options for SVG images.
GenericImage(
src: 'path_to_your_image/image.svg',
format: ImageFormat.svg,
svgStyle: SvgStyle(
color: Colors.red,
alignment: Alignment.center,
// ... other style properties ...
),
)
copied to clipboard
Example App #
There's a detailed example project in the example directory showcasing various features of the generic_image package. To run it:
Navigate to the example directory:
cd example
copied to clipboard
Run the example app:
flutter run
copied to clipboard
Contribution #
Feel free to open an issue or submit a pull request if you find any bugs or have some suggestions for improvements.
License #
MIT License
Please adapt the content as per your requirements, such as the version number, additional features, etc. The README.md should be comprehensive, up-to-date, and offer clear instructions and descriptions for your users.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.