PolygonController constructor

PolygonController({
  1. required Polygon polygon,
  2. bool consumeTapEvents = false,
  3. VoidCallback? onTap,
  4. required VoidCallback? onDragend,
  5. required VoidCallback? onInsertAt,
  6. required VoidCallback? onRemoveAt,
  7. 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();
    });
  }
}