google_map_drawer 0.0.1
google_map_drawer: ^0.0.1 copied to clipboard
A Flutter package to draw polygons on Google Maps and manage locations easily.
Google Map Drawer #
A Flutter package to draw polygons on Google Maps easily, save them as areas, and manage location markers with metadata.
Features #
- Draw polygons directly on Google Maps.
- Undo last point or clear polygon.
- Save drawn polygons with a name.
- Manage multiple saved areas.
- Supports custom markers with
LocationInfo. - Easy-to-use controller for managing drawing.
Installation #
Add to your pubspec.yaml:
dependencies:
google_map_drawer: ^0.0.1
## Usage
import 'package:flutter/material.dart';
import 'package:google_map_drawer/google_map_drawer.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(title: const Text("Map Drawer Example")),
body: MapExample(),
),
);
}
}
class MapExample extends StatefulWidget {
@override
State<MapExample> createState() => _MapExampleState();
}
class _MapExampleState extends State<MapExample> {
final GoogleMapDrawController mapController = GoogleMapDrawController();
@override
Widget build(BuildContext context) {
return Stack(
children: [
GoogleMapDrawer(
controller: mapController,
),
Positioned(
bottom: 16,
right: 16,
child: FloatingActionButton(
child: const Icon(Icons.save),
onPressed: () {
mapController.saveArea("My Area");
print(mapController.savedAreas);
},
),
)
],
);
}
}