Skip to content

A Flutter package to read a image for extracting its dominant color.

License

Notifications You must be signed in to change notification settings

janlionly/flutter_image_color_builder

Repository files navigation

Image Color Builder

pub packageStar on Github

A Flutter package for generating the image and the image's dominant color with a given image url.

Usage

See examples to /example folder.

ImageColorBuilder(
  url: 'https://picsum.photos/200',
  // url: 'assets/images/local.jpg', // support to read local image
  fit: BoxFit.cover,
  maxCachedCount: 15,
  builder: (BuildContext context, Image? image, Color? imageColor) {
    return Container(
      padding: const EdgeInsets.all(40),
      decoration: BoxDecoration(
        color: imageColor?.withOpacity(0.8) ?? Colors.red,
        borderRadius: const BorderRadius.all(Radius.circular(8)),
      ),
      child: image ?? const Text('No image?'),
    );
  },
  placeholder: (contect, url) => Image.asset(
    'assets/images/placeholder.png',
    fit: BoxFit.fill,
  ),
  errorWidget: (context, url, error) => Image.asset(
    'assets/images/error.png',
    fit: BoxFit.fill,
  ),
)

Author

Visit my github: janlionly
Contact with me by email: [email protected]

Contribute

I would love you to contribute to ImageColorBuilder

License

ImageColorBuilder is available under the MIT license. See the LICENSE file for more info.

About

A Flutter package to read a image for extracting its dominant color.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages