general_image_widget 1.0.0 copy "general_image_widget: ^1.0.0" to clipboard
general_image_widget: ^1.0.0 copied to clipboard

A general Image widget that unifies Image.asset, Image.file and Image.network with just one class. Just add in the path, url or assetname.

This widget unifies the different methods on loading an image.

Features #

  • support to load image from network
  • support to load image from file
  • support to load image from asset
  • support soft error handling, displaying a gray box if the path provided is not valid

This widget automatically detects which type of path/url/asset was passed to it.

Getting started #

No prerequisites are required to use this package. Simply append it to your project.

Usage #

Examples for each type of usage:

  • Load by path:
ImageWidget(
  imagePath: '/path/to/local/file.jpg', // Absolute path to the image on the local file system
  width: 100,
  height: 100,
  fit: BoxFit.fill,
)
  • Load by asset:
ImageWidget(
  imagePath: 'assets/images/my_local_image.png', // Path relative to the assets directory
  width: 100,
  height: 100,
  fit: BoxFit.cover,
)
  • Load by url:
ImageWidget(
  imagePath: 'https://example.com/image.jpg', // Full URL to the image on the web
  width: 100,
  height: 100,
  fit: BoxFit.scaleDown,
)

Additional information #

Feel free to suggest and add modifications to this repository. This repository will be updated on demand.

1
likes
140
points
24
downloads

Publisher

unverified uploader

Weekly Downloads

A general Image widget that unifies Image.asset, Image.file and Image.network with just one class. Just add in the path, url or assetname.

Homepage

Documentation

API reference

License

BSD-2-Clause (license)

Dependencies

flutter

More

Packages that depend on general_image_widget