google_maps_drawing_tools 0.0.1
google_maps_drawing_tools: ^0.0.1 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, opacity, and other styling options.
- Selection & Deletion: Tap to select shapes and remove them as needed.
- 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:
git:
url: https://github.com/ExploreAritra/google_maps_drawing_tools.git
ref: dev
Then, run:
flutter pub get
π οΈ Usage #
1. Initialize the Drawing Controller #
final drawingController = DrawingController();
2. Integrate with GoogleMap Widget #
GoogleMap(
onMapCreated: (GoogleMapController controller) {
drawingController.setMapController(controller);
},
markers: drawingController.markers,
polygons: drawingController.polygons,
circles: drawingController.circles,
onTap: drawingController.onMapTap,
onLongPress: drawingController.onMapLongPress,
// ... other 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 #
Add screenshots or GIFs here to showcase drawing and editing functionalities.
π§ͺ Example #
An example application demonstrating the package's capabilities is available in the example/
directory.
To run it:
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.