polygon_map 0.0.6
polygon_map: ^0.0.6 copied to clipboard
A flexible Flutter map widget for creating, editing, and managing polygons with interactive controls.
polygon_map #
polygon_map — a lightweight and easy-to-use package for working with map polygons. Create, edit, and display geometric areas with flexible customization.
Please star the repository to support the project!
Screenshots #
Getting Started #
To use this package, add it to your pubspec.yaml:
dependencies:
polygon_map: ^0.0.6
or run the command
flutter pub add polygon_map
Using the player #
class _MyAppState extends State<MyApp> {
final controller = PolygonMapController();
@override
void initState() {
super.initState();
controller.addListener(_onControllerChanged);
controller.setPolygons([
PolygonModel(
borderColor: Colors.red,
points: [
LatLng(34.0925, -118.2750),
LatLng(34.0925, -118.2050),
LatLng(34.0225, -118.1950),
LatLng(34.0125, -118.2050),
LatLng(34.0125, -118.2750),
],
),
]);
}
void _onControllerChanged() {
debugPrint("last polygon: ${controller.polygons.last.points}");
}
@override
void dispose() {
controller.removeListener(_onControllerChanged);
controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
body: PolygonMap(
controller: controller,
mapType: MapTypeEnum.esriSatellite,
),
),
);
}
}
