pixel_color_image 1.3.0 pixel_color_image: ^1.3.0 copied to clipboard
Pick the pixel color of a image. onHover, onTap, and the Preview widget.
https://pub.dev/packages/pixel_color_image
Usage #
1. Widget #
- image in assets folder
PixelColor.assetImage(
path: 'images/xxx.png',
onHover: onHover,
onTap: onTap,
);
- image by URL
PixelColor.networkImage(
url: 'https://example.com/xxx.png',
onHover: onHover,
onTap: onTap,
);
2. functions are called #
/// While Hoverring
void onHover(int x, int y, Color color) async {
debugPrint('Hover x: $x, y: $y, color: $color');
}
/// When tap
void onTap(int x, int y, Color color) async {
debugPrint('Tap x: $x, y: $y, color: $color');
}
Color-Preview Widget #
1. Define ref #
final ref = PixelColorRef();
2. Connect widgets with ref #
// Image
PixelColor.assetImage(
...
...
ref: ref,
);
// Color Preview
PixelColorPreview(
ref: ref,
);
🎉 any issues, requests, contributions are welcomed!