pixel_color_image 1.2.1 pixel_color_image: ^1.2.1 copied to clipboard
Pick the pixel color of a image. onHover, onTap, and the Preview widget.
Pixel Color Image #
https://pub.dev/packages/pixel_color_image
Usage #
1. Create widget #
- use asset image
const pixelColorImage = PixelColor.assetImage(
path: 'images/xxx.png',
onHover: onHover,
onTap: onTap,
);
- use url image
const pixelColorImage = PixelColor.networkImage(
url: 'https://example.com/xxx.png',
onHover: onHover,
onTap: onTap,
);
2. these functions are called #
/// Called while Hoverring
void onHover(int x, int y, Color color) async {
debugPrint('Hover x: $x, y: $y, color: $color');
}
/// Called when tap
void onTap(int x, int y, Color color) async {
debugPrint('Tap x: $x, y: $y, color: $color');
}
Color-Preview Widget #
- diagram explain
1. create Ref (put it at the place you can keep e.g. global) #
final ref = PixelColorRef();
2. pass ref to the PixelColor widget #
final img = PixelColor.assetImage(
...
...
ref: ref,
);
3. pass ref to the Rreview widget #
final preview = PixelColorPreview(
ref: ref,
);
🎉 any issues, requests, contributions are welcomed!