SfMapsThemeData constructor Null safety

SfMapsThemeData(
  1. {Brightness? brightness,
  2. Color? layerColor,
  3. Color? layerStrokeColor,
  4. double? layerStrokeWidth,
  5. Color? shapeHoverColor,
  6. Color? shapeHoverStrokeColor,
  7. double? shapeHoverStrokeWidth,
  8. TextStyle? legendTextStyle,
  9. Color? markerIconColor,
  10. Color? markerIconStrokeColor,
  11. double? markerIconStrokeWidth,
  12. TextStyle? dataLabelTextStyle,
  13. Color? bubbleColor,
  14. Color? bubbleStrokeColor,
  15. double? bubbleStrokeWidth,
  16. Color? bubbleHoverColor,
  17. Color? bubbleHoverStrokeColor,
  18. double? bubbleHoverStrokeWidth,
  19. Color? selectionColor,
  20. Color? selectionStrokeColor,
  21. double? selectionStrokeWidth,
  22. Color? tooltipColor,
  23. Color? tooltipStrokeColor,
  24. double? tooltipStrokeWidth,
  25. BorderRadiusGeometry? tooltipBorderRadius,
  26. Color? toggledItemColor,
  27. Color? toggledItemStrokeColor,
  28. double? toggledItemStrokeWidth}
)

Returns a new instance of SfMapsThemeData.raw for the given values.

If any of the values are null, the default values will be set.

Implementation

factory SfMapsThemeData({
  Brightness? brightness,
  Color? layerColor,
  Color? layerStrokeColor,
  double? layerStrokeWidth,
  Color? shapeHoverColor,
  Color? shapeHoverStrokeColor,
  double? shapeHoverStrokeWidth,
  TextStyle? legendTextStyle,
  Color? markerIconColor,
  Color? markerIconStrokeColor,
  double? markerIconStrokeWidth,
  TextStyle? dataLabelTextStyle,
  Color? bubbleColor,
  Color? bubbleStrokeColor,
  double? bubbleStrokeWidth,
  Color? bubbleHoverColor,
  Color? bubbleHoverStrokeColor,
  double? bubbleHoverStrokeWidth,
  Color? selectionColor,
  Color? selectionStrokeColor,
  double? selectionStrokeWidth,
  Color? tooltipColor,
  Color? tooltipStrokeColor,
  double? tooltipStrokeWidth,
  BorderRadiusGeometry? tooltipBorderRadius,
  Color? toggledItemColor,
  Color? toggledItemStrokeColor,
  double? toggledItemStrokeWidth,
}) {
  brightness = brightness ?? Brightness.light;
  final bool isLight = brightness == Brightness.light;
  layerColor ??= isLight
      ? const Color.fromRGBO(224, 224, 224, 1)
      : const Color.fromRGBO(97, 97, 97, 1);
  layerStrokeColor ??= isLight
      ? const Color.fromRGBO(158, 158, 158, 0.5)
      : const Color.fromRGBO(224, 224, 224, 0.5);
  layerStrokeWidth ??= 1.0;
  markerIconColor ??= isLight
      ? const Color.fromRGBO(98, 0, 238, 1)
      : const Color.fromRGBO(187, 134, 252, 1);
  markerIconStrokeWidth ??= 1.0;
  bubbleColor ??= isLight
      ? const Color.fromRGBO(98, 0, 238, 0.5)
      : const Color.fromRGBO(187, 134, 252, 0.8);
  bubbleStrokeColor ??= Colors.transparent;
  bubbleStrokeWidth ??= 1.0;
  selectionColor ??= isLight
      ? const Color.fromRGBO(117, 117, 117, 1)
      : const Color.fromRGBO(224, 224, 224, 1);
  selectionStrokeColor ??= isLight
      ? const Color.fromRGBO(158, 158, 158, 1)
      : const Color.fromRGBO(97, 97, 97, 1);
  selectionStrokeWidth ??= 0.5;
  tooltipColor ??= isLight
      ? const Color.fromRGBO(117, 117, 117, 1)
      : const Color.fromRGBO(245, 245, 245, 1);
  tooltipStrokeWidth ??= 1.0;
  tooltipBorderRadius ??= const BorderRadius.all(Radius.circular(4.0));
  toggledItemColor ??= isLight
      ? const Color.fromRGBO(245, 245, 245, 1)
      : const Color.fromRGBO(66, 66, 66, 1);
  toggledItemStrokeColor ??= isLight
      ? const Color.fromRGBO(158, 158, 158, 1)
      : const Color.fromRGBO(97, 97, 97, 1);

  return SfMapsThemeData.raw(
    brightness: brightness,
    layerColor: layerColor,
    layerStrokeColor: layerStrokeColor,
    shapeHoverColor: shapeHoverColor,
    shapeHoverStrokeColor: shapeHoverStrokeColor,
    legendTextStyle: legendTextStyle,
    markerIconColor: markerIconColor,
    markerIconStrokeColor: markerIconStrokeColor,
    dataLabelTextStyle: dataLabelTextStyle,
    bubbleColor: bubbleColor,
    bubbleStrokeColor: bubbleStrokeColor,
    bubbleStrokeWidth: bubbleStrokeWidth,
    bubbleHoverColor: bubbleHoverColor,
    bubbleHoverStrokeColor: bubbleHoverStrokeColor,
    bubbleHoverStrokeWidth: bubbleHoverStrokeWidth,
    selectionColor: selectionColor,
    selectionStrokeColor: selectionStrokeColor,
    tooltipColor: tooltipColor,
    tooltipStrokeColor: tooltipStrokeColor,
    tooltipStrokeWidth: tooltipStrokeWidth,
    tooltipBorderRadius: tooltipBorderRadius,
    selectionStrokeWidth: selectionStrokeWidth,
    layerStrokeWidth: layerStrokeWidth,
    shapeHoverStrokeWidth: shapeHoverStrokeWidth,
    markerIconStrokeWidth: markerIconStrokeWidth,
    toggledItemColor: toggledItemColor,
    toggledItemStrokeColor: toggledItemStrokeColor,
    toggledItemStrokeWidth: toggledItemStrokeWidth,
  );
}