MapMarkerTextStyle.withFont constructor

MapMarkerTextStyle.withFont(
  1. double textSize,
  2. Color textColor,
  3. double textOutlineSize,
  4. Color textOutlineColor,
  5. List<MapMarkerTextStylePlacement> placements,
  6. String fontName,
)

Creates a set of styling options for the text of a MapMarker.

Note: This is a beta release of this feature, so there could be a few bugs and unexpected behavior. Related APIs may change for new releases without a deprecation process.

List of placements is used to specify allowed placement of text relative to the icon. When marker overlapping is allowed as set by MapMarker.isOverlapAllowed, only first placement element is considered. Otherwise the placement value is chosen so that the text does not overlap with other MapMarker instances.

Placement values are prioritized according to the order in which they appear in the list. Lists with duplicate entries as well as empty lists are not supported.

  • textSize The size of the text in pixels. Only positive values are supported.

  • textColor The text color.

  • textOutlineSize The size of the text outline in pixels. Only non-negative values are supported.

  • textOutlineColor The color of the text outline.

  • placements List of allowed placements of the text relative to the icon of a MapMarker.

  • fontName Font name, registered with AssetsManager.registerFont. If empty string is provided, a default font will be used.

Throws MapMarkerTextStyleInstantiationException. In case of invalid input parameters.

Implementation

factory MapMarkerTextStyle.withFont(double textSize, ui.Color textColor, double textOutlineSize, ui.Color textOutlineColor, List<MapMarkerTextStylePlacement> placements, String fontName) => $prototype.withFont(textSize, textColor, textOutlineSize, textOutlineColor, placements, fontName);