Package selection guidance compiled from public package information, community data, and project usage.
A Flutter package that enables interactive editing of lines and polygons within the flutter_map widget. It provides draggable markers for adjusting vertices, allowing users to create or modify vector shapes directly on a map. Designed for geolocation applications requiring user input on map geometry, it integrates seamlessly with flutter_map's existing features. The editor supports both line and polygon shapes, offering intuitive point manipulation through touch or mouse interactions across all supported platforms.
Use cases
Map-based shape creation
Interactive route planning
Geospatial data annotation
Polygon boundary editing
Real-time map drawing
User-driven map geometry input
Key features
Draggable vertex markers
Support for lines and polygons
Seamless integration with flutter_map
Cross-platform compatibility
Real-time shape updates
Simple API for initialization and event handling
Suitable for
GIS applications
Mapping tools with user input
Interactive map dashboards
Field data collection apps
Educational mapping software
Prototyping map interaction features
Considerations
Requires flutter_map dependency
Limited to basic shape editing
No built-in snapping or alignment
May need custom styling for markers
Performance impact with many vertices
Not suitable for complex geometry operations
Original README
Original README snapshot from the linked source repository. Visit the repository for the latest content.
See the example directory for a complete example app demonstrating the usage
of this package, here are the most important features:
Tap the map to add a marker, add as many as you want.
Drag the main points to move them.
Drag the intermediate points to create a new point there and drag to where you
want.
Long press to delete a point.
Usage
Once the package is installed, make sure to import the package in the file that
you are going to need it, you may also need to import flutter_map_dragmarker:
Set up a new editor instance, tipically inside initState():
var polyEditor = PolyEditor(
points: testPolyline.points,
pointIcon: Icon(Icons.crop_square, size: 23),
intermediateIcon: Icon(Icons.lens, size: 15, color: Colors.grey),
callbackRefresh: () => { this.setState(() {})},
addClosePathMarker: false, // set to true if polygon
);
The PolyEditor takes a list of LatLng points that are used to put
DragMarker's over these locations. PolyEditor does not care if the given
list of points is a polyline, it could be something else. This list will be
edited in place so that when the build method is triggered it will use updated
points.
You must also pass a Widget (tipically an Icon) using the pointIcon
parameter that will be used to represent each DragMarker.
You may also pass the optional parameter intermediateIconto display another
DragMarker halfway between the main points. Dragging this marker will create
another main point and the line will be split.
The screen needs to be updated during a drag, so callbackRefresh takes a
function that will get called each drag frame.
For polygons or “closed paths” set the parameter addClosePathMarker to true
so that the end auto-returns to the start. Otherwise, if you just want a basic
polyline, set this to false.
You can add a point programmatically using the onTap callback in MapOptions: