draw_on

Creator: coderz1093

Last updated:

0 purchases

draw_on Image
draw_on Images

Languages

Categories

Add to Cart

Description:

draw on

Draw On #

A flutter plugin to draw the coordinates on widget and as well as to find the given point is inside a list of coordinates or not.
For Draw on widget #
DrawOnWidget(
widget: _DrawOnImageWidget(),
correctAnswerCoordinates: selectedPositions,
getXaxis: (xAxis) {
setState(() {
selectedX = xAxis;
});
},
getYaxis: (yAxis) {
setState(() {
selectedY = yAxis;
});
},
showPointer: showPointer,
onTap: () {
setState(() {
showPointer = true;
if (selectedPositions.last.length > 3 &&
selectedPositions.last.first == selectedPositions.last.last) {
selectedPositions.add([]);
}
Offset? nearestValue = Polygon.getNearestPoint(
selectedPositions.last, Offset(selectedX!, selectedY!));
selectedPositions.last.add(Offset(selectedX!, selectedY!));
if (nearestValue != null) {
selectedPositions.last.add(nearestValue);
}
selectedX = null;
selectedY = null;
});
print(selectedPositions);
},
pointsColor: Colors.green,
lineColor: Colors.green,
),
copied to clipboard
For Select Area Widget #
SelectAreaWidget(
correctAnswerCoordinates: correctAnswerCoordinates,
widget: _DrawOnImageWidget(),
isSelectable: isSelectable,
getXaxis: (xAxis) {
setState(() {
selectedPositionX = xAxis;
});
},
showPointer: showPointer,
getYaxis: (yAxis) {
setState(() {
selectedPositionY = yAxis;
});
},
onTap: () {
setState(() {
showPointer = true;
});
},
pointsColor: Colors.red,
lineColor: Colors.green,
),
copied to clipboard
To find nearest point #
Polygon.getNearestPoint(points, currentPoints);
copied to clipboard
To find whether the given point is inside the coordinates #
Polygon polygon = Polygon(polygonPoints);
isInside = polygon.isPointInside(Offset(xAxis, yAxis));
copied to clipboard
Demo #

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.