PolygonController constructor
PolygonController({
- required Polygon polygon,
- bool consumeTapEvents = false,
- VoidCallback? onTap,
- required VoidCallback? onDragend,
- required VoidCallback? onInsertAt,
- required VoidCallback? onRemoveAt,
- required VoidCallback? onSetAt,
Creates a PolygonController
that wraps a gmaps.Polygon
object and its onTap
behavior.
Implementation
PolygonController({
required gmaps.Polygon polygon,
bool consumeTapEvents = false,
ui.VoidCallback? onTap,
required ui.VoidCallback? onDragend,
required ui.VoidCallback? onInsertAt,
required ui.VoidCallback? onRemoveAt,
required ui.VoidCallback? onSetAt,
}) : _polygon = polygon,
_consumeTapEvents = consumeTapEvents {
if (onTap != null) {
polygon.onClick.listen((gmaps.PolyMouseEvent event) {
onTap.call();
});
polygon.onDragend.listen((gmaps.MapMouseEvent event) {
onDragend?.call();
});
polygon.path!.onInsertAt.listen((_) {
onInsertAt?.call();
});
polygon.path!.onRemoveAt.listen((_) {
onRemoveAt?.call();
});
polygon.path!.onSetAt.listen((_) {
onSetAt?.call();
});
}
}