google_maps_drawing_tools 0.0.6 copy "google_maps_drawing_tools: ^0.0.6" to clipboard
google_maps_drawing_tools: ^0.0.6 copied to clipboard

A Flutter plugin that adds drawing tools (polygons, circles, rectangles) on Google Maps, enabling users to interactively draw and edit shapes within a Flutter application.

πŸ—ΊοΈ google_maps_drawing_tools #

A powerful Flutter package that brings advanced drawing tools to Google Maps.
With support for polygons, rectangles, and circles, it enables interactive drawing, editing, and customization directly on the map.
Ideal for applications involving geofencing, region selection, and spatial data visualization.


✨ Features #

  • Interactive Drawing: Draw polygons, rectangles, and circles directly on the map with intuitive gestures.
  • Editing Capabilities: Modify shapes by dragging vertices or edges.
  • Customizable Styles: Adjust stroke and fill colors and other styling options.
  • Selection & Deletion: Tap to select shapes and remove them as needed.
  • Import & Export: Import and export shapes in GeoJSON format.
  • Event Callbacks: Hook into drawing and editing events for custom behaviors.
  • Modular Architecture: Clean codebase designed for easy integration and extension.

πŸ“¦ Installation #

Add the package to your pubspec.yaml:

dependencies:
  google_maps_drawing_tools: ^0.0.6

Then, run:

flutter pub get

Setup Requirement #

Before using this package, make sure you have set up correctly by following its official instructions here.


πŸ› οΈ Usage #

1. Initialize the Drawing Controller #

final drawingController = DrawingController();

2. Integrate with GoogleMap Widget #

DrawingMapWidget(
  initialCameraPosition: CameraPosition(
    target: LatLng(37.7749, -122.4194),
    zoom: 14,
  ),
  controller: drawingController,
  webGestureHandling: WebGestureHandling.cooperative,
// ... other Google map properties
)

3. Start Drawing #

// To start drawing a polygon
drawingController.startDrawing(DrawMode.polygon);

// To start drawing a rectangle
drawingController.startDrawing(DrawMode.rectangle);

// To start drawing a circle
drawingController.startDrawing(DrawMode.circle);

4. Finish Drawing #

drawingController.finishDrawing();

5. Update Shape Color #

drawingController.updateColor(shapeId, newColor);

6. Delete a Shape #

drawingController.deleteShape(shapeId);

πŸ“Έ Screenshots #

Drawing Circle Drawing Rectangle Drawing Polygon Drawing Freehand Drawing Usage


πŸ§ͺ Example #

An example application demonstrating the package's capabilities is available in the example/ directory.

To run it:

Add MAPS_API_KEY=Your_API_Key to local.properties inside the example/android directory.

cd example
flutter run

πŸ“„ License #

This project is licensed under the MIT License. See the LICENSE file for details.


πŸ™Œ Contributions #

Contributions are welcome!
Feel free to submit issues or pull requests to enhance the package.


For more details and updates, visit the google_maps_drawing_tools GitHub repository.

7
likes
160
points
352
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter plugin that adds drawing tools (polygons, circles, rectangles) on Google Maps, enabling users to interactively draw and edit shapes within a Flutter application.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

collection, flutter, geolocator, google_maps_flutter, pointer_interceptor

More

Packages that depend on google_maps_drawing_tools