Flood Fill Image

Version GitHub license Support

Overview

Flutter widget that can use paint bucket functionality on the provided image using Queue-Linear Flood Fill Algorithm by J. Dunlap. For more info check out my blog : Flood Fill in Flutter

Kindly like:+1: the package at pub dev or star:star: the repo in github if you find this library useful. :wink:

demo dog gif

Usage

FloodFillImage(
    imageProvider: AssetImage("assets/dog.jpg"),
    fillColor: Colors.amber,
    avoidColor: [Colors.transparent, Colors.black],
)

Parameters

NameTypeDescription
imageProviderImageProviderThe image to display via ImageProvider.
You can use AssetImage or NetworkImage.
fillColorColorColor use for filling the area.
isFillActiveboolSet false if you want to disable on touch fill function.
Default value is true.
avoidColorList<Color>List of color that determines to which Color is/are needed to be avoided upon touch.
Note: Nearest color shade is applied.
toleranceintSet fill value tolerance that ranges from 0 to 100.
Default value is 8.
widthintWidth of the image. Parent widget width will be prioritize if it's provided and less than the image width.
heightintHeight of the image. Parent widget height will be prioritize if it's provided and less than the image height.
alignmentAlignmentGeometryAlignment of the image.
loadingWidgetWidgetWidget to show while the image is being processed on initialization.
It uses CircularProgressIndicator by default.
onFloodFillStartFunction(Offset position,Image image)Callback function that returns the touch position and an Image from dart:ui when flood fill starts.
Note: Touch coordinate is relative to the image dimension.
onFloodFillEndFunction(Image image)Callback function that returns an Image from dart:ui when flood fill ended.

Coffee

Buy Me A Coffee

License

MIT License, see the LICENSE.md file for details.

Libraries

floodfill_image