PopupMarkerLayerOptions constructor

PopupMarkerLayerOptions({
  1. required List<Marker> markers,
  2. PopupDisplayOptions? popupDisplayOptions,
  3. PopupController? popupController,
  4. List<PopupSpec> initiallySelected = const [],
  5. Widget selectedMarkerBuilder(
    1. BuildContext context,
    2. Marker marker
    )?,
  6. MarkerCenterAnimation? markerCenterAnimation,
  7. MarkerTapBehavior? markerTapBehavior,
  8. dynamic onPopupEvent(
    1. PopupEvent event,
    2. List<Marker> selectedMarkers
    )?,
})

Show the list of markers on the map with a popups that are shown when a marker is tapped or when triggered via the popupController.

Use popupBuilder to build the popup widget and popupSnap to control where the popup appears. rebuild can be used to force a rebuild of the layer.

Important notes about rotation:

Note: This only applies if the chosen PopupSnap snaps to the Marker. If you are snapping to the map then the rotation origin and rotation alignment have to effect on the popup.

In order for the popup to be placed correctly relative to the Marker, the Marker rotation origin and rotation alignment must be correctly set with respect to the Marker's anchor. If you are using one of the AnchorAlign values for the anchor then the rotation origin can be left null and the rotation alignment should be set to the value returned by by calling rotationAlignment on the AnchorAlign value.

If you are not using an AnchorAlign for the anchor position you must set the rotation origin and rotation alignment such that whilst rotating the map:

  • The anchor point does not move relative to the Marker's point.
  • The Marker's orientation matches the rotation.

Implementation

PopupMarkerLayerOptions({
  required this.markers,
  this.popupDisplayOptions,
  this.popupController,
  this.initiallySelected = const [],
  this.selectedMarkerBuilder,
  this.markerCenterAnimation,
  MarkerTapBehavior? markerTapBehavior,
  this.onPopupEvent,
}) : markerTapBehavior =
          markerTapBehavior ?? MarkerTapBehavior.togglePopupAndHideRest();