PopupMarkerLayerOptions constructor

PopupMarkerLayerOptions({
  1. List<Marker> markers = const [],
  2. bool? markerRotate = true,
  3. AlignmentGeometry? markerRotateAlignment,
  4. Offset? markerRotateOrigin,
  5. PopupBuilder? popupBuilder,
  6. PopupController? popupController,
  7. List<Marker> initiallySelectedMarkers = const [],
  8. PopupSnap popupSnap = PopupSnap.markerTop,
  9. PopupAnimation? popupAnimation,
  10. Widget selectedMarkerBuilder(
    1. BuildContext context,
    2. Marker marker
    )?,
  11. MarkerCenterAnimation? markerCenterAnimation,
  12. MarkerTapBehavior? markerTapBehavior,
  13. dynamic onPopupEvent(
    1. PopupEvent event,
    2. List<Marker> selectedMarkers
    )?,
  14. Stream<void>? rebuild,
})

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 using to the value returned by PopupMarkerLayerOptions.rotationAlignmentFor(anchorAlign), either at the Marker level or for all markers using markerRotateAlignment.

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({
  List<Marker> markers = const [],
  bool? markerRotate = true,
  AlignmentGeometry? markerRotateAlignment,
  Offset? markerRotateOrigin,
  this.popupBuilder,
  this.popupController,
  this.initiallySelectedMarkers = const [],
  this.popupSnap = PopupSnap.markerTop,
  this.popupAnimation,
  this.selectedMarkerBuilder,
  this.markerCenterAnimation,
  MarkerTapBehavior? markerTapBehavior,
  this.onPopupEvent,
  Stream<void>? rebuild,
})  : markerTapBehavior =
          markerTapBehavior ?? MarkerTapBehavior.togglePopupAndHideRest(),
      super(
        markers: markers,
        rotate: markerRotate,
        rotateAlignment: markerRotateAlignment,
        rotateOrigin: markerRotateOrigin,
        rebuild: rebuild,
      );