The Image Masking Flutter Plugin allows developers to create an interactive image reveal effect. It allows users to interactively reveal or color an image by dragging their fingers across the screen.
To use this package, add image_masking_flutter
as a dependency in your pubspec.yaml
file:
dependencies:
image_masking_flutter: ^1.0.0
import 'package:image_masking_flutter/image_masking_widget.dart';
Create a GlobalKey
final GlobalKey<ImageMaskingWidgetState> _imageMaskingKey = GlobalKey<ImageMaskingWidgetState>();
Use Image Masking Widget
ImageMaskingWidget(
key: _imageMaskingKey,
height: MediaQuery.of(context).size.height/2,
width: MediaQuery.of(context).size.width,
margin: EdgeInsets.symmetric(vertical: MediaQuery.of(context).size.height/4,horizontal: 15),
decoration: BoxDecoration(
border: Border.all(color: Colors.black, width: 2)),
coloredImage: "assets/images/kid_color.jpeg", //Use colored image here
unColoredImage: "assets/images/kid_uncolor.jpeg", //Use outlined image without color with same size & resolution according to above colored image
)
Reset the view
_imageMaskingKey.currentState?.resetView();
Follow LinkedIn: @Sohit-Sharma
If you find a bug or want to contribute to this project, feel free to open an issue or submit a pull request. Contributions are welcome!