draw_on 0.0.1+2 copy "draw_on: ^0.0.1+2" to clipboard
draw_on: ^0.0.1+2 copied to clipboard

A flutter plugin to draw the coordinates on the widget and as well as to find the given point is inside a list of coordinates or not.

Draw On #

Pub Version

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,
),

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,
),

To find nearest point #

Polygon.getNearestPoint(points, currentPoints);

To find whether the given point is inside the coordinates #

Polygon polygon = Polygon(polygonPoints);
isInside = polygon.isPointInside(Offset(xAxis, yAxis));

Demo #

example-location-builders

14
likes
130
pub points
55%
popularity

Publisher

unverified uploader

A flutter plugin to draw the coordinates on the widget and as well as to find the given point is inside a list of coordinates or not.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on draw_on