This Flutter package provides a simple way to show images from the Internet or from assets. It supports both PNG and SVG images.
Features
- Show images from the Internet with a single line of code:
GeneralNetworkImage(url: "url",height: 50, width: 50,matchTextDirection: true,)
- Show images from assets with a single line of code:
GeneralImageAssets(path: "assets_path",width: 50,height: 50,color: Colors.red,matchTextDirection: true,boxFit: BoxFit.contain,)
- Cache images to improve performance
- Support for both PNG and SVG images in one line
Getting started
To use the GeneralImage package, simply import it into your project:
import 'package:general_image/general_image.dart';
Usage
If you want to show the image, in case of "svg" or "png" use this code:
GeneralNetworkImage(
url: "url",
height: 50, width: 50,
matchTextDirection: true,
boxFit: BoxFit.fill,
color: Colors.green,
failWidget:Icon(Icons.error) ),
If you want to show the image from your assets, in case of "svg" or "png" use this code:
GeneralImageAssets(
path: "path",
width: 50,height: 50,
color: Colors.red,
matchTextDirection: true,
boxFit: BoxFit.contain,)
the package takes the following parameters:
-
url
: The URL of the image. -
height
: The height of the image in pixels. -
width
: The width of the image in pixels. -
matchTextDirection
: support RTL. -
color
:The color of the image. -
boxFit
:The way in which the image should be scaled to fit the available space.
Plugins
Conclusion
The GeneralImage package provides a simple way to show images from the Internet or from assets. It supports both PNG and SVG images, and it caches images to improve performance.
Author
- Hassan Hallak
- hassanhallak4000@gmail.com