Skip to content

SDKs · Flutter

Step 5 — Taps & info windows

Respond to taps and anchor a widget above a marker.

Interactions
UbHubMap(
  options: options,
  height: 480,
  markers: markers,
  onMarkerTap: (marker) => debugPrint('tapped ${marker.id}'),
  onPolylineTap: (line) {},
  onPolygonTap: (polygon) {},
  onCircleTap: (circle) {},
  onTap: (point) {},        // basemap tap only
  onLongPress: (point) {},  // long press on the basemap
  infoWindowBuilder: (context, marker) => Card(
    child: Padding(padding: const EdgeInsets.all(8), child: Text(marker.label ?? '')),
  ),
);
  • onMarkerTap/onPolylineTap/onPolygonTap/onCircleTap give you the annotation and its data.
  • onTap fires only for basemap taps; onLongPress is a long press on the basemap.
  • infoWindowBuilder shows your widget above the tapped marker and tracks the camera.