copyWith method

MapLegend copyWith({
  1. Axis? direction,
  2. EdgeInsetsGeometry? padding,
  3. MapLegendPosition? position,
  4. Widget? title,
  5. Offset? offset,
  6. double? spacing,
  7. MapIconType? iconType,
  8. TextStyle? textStyle,
  9. Size? iconSize,
  10. Size? segmentSize,
  11. MapLegendOverflowMode? overflowMode,
  12. bool? enableToggleInteraction,
  13. Color? toggledItemColor,
  14. Color? toggledItemStrokeColor,
  15. double? toggledItemStrokeWidth,
  16. double? toggledItemOpacity,
  17. MapElement? source,
  18. MapLegendLabelsPlacement? labelsPlacement,
  19. MapLegendEdgeLabelsPlacement? edgeLabelsPlacement,
  20. MapLabelOverflow? labelOverflow,
  21. MapLegendPaintingStyle? segmentPaintingStyle,
  22. bool? showPointerOnHover,
  23. MapLegendPointerBuilder? pointerBuilder,
  24. Color? pointerColor,
  25. Size? pointerSize,
})

Creates a copy of this class but with the given fields replaced with the new values.

Implementation

MapLegend copyWith({
  Axis? direction,
  EdgeInsetsGeometry? padding,
  MapLegendPosition? position,
  Widget? title,
  Offset? offset,
  double? spacing,
  MapIconType? iconType,
  TextStyle? textStyle,
  Size? iconSize,
  Size? segmentSize,
  MapLegendOverflowMode? overflowMode,
  bool? enableToggleInteraction,
  Color? toggledItemColor,
  Color? toggledItemStrokeColor,
  double? toggledItemStrokeWidth,
  double? toggledItemOpacity,
  MapElement? source,
  MapLegendLabelsPlacement? labelsPlacement,
  MapLegendEdgeLabelsPlacement? edgeLabelsPlacement,
  MapLabelOverflow? labelOverflow,
  MapLegendPaintingStyle? segmentPaintingStyle,
  bool? showPointerOnHover,
  MapLegendPointerBuilder? pointerBuilder,
  Color? pointerColor,
  Size? pointerSize,
}) {
  if (_type == _LegendType.vector) {
    return MapLegend(
      source ?? this.source,
      title: title ?? this.title,
      direction: direction ?? this.direction,
      padding: padding ?? this.padding,
      position: position ?? this.position,
      offset: offset ?? this.offset,
      spacing: spacing ?? this.spacing,
      iconType: iconType ?? this.iconType,
      textStyle: textStyle ?? this.textStyle,
      iconSize: iconSize ?? this.iconSize,
      overflowMode: overflowMode ?? this.overflowMode,
      enableToggleInteraction:
          enableToggleInteraction ?? this.enableToggleInteraction,
      toggledItemColor: toggledItemColor ?? this.toggledItemColor,
      toggledItemStrokeColor:
          toggledItemStrokeColor ?? this.toggledItemStrokeColor,
      toggledItemStrokeWidth:
          toggledItemStrokeWidth ?? this.toggledItemStrokeWidth,
      toggledItemOpacity: toggledItemOpacity ?? this.toggledItemOpacity,
    );
  } else {
    return MapLegend.bar(
      source ?? this.source,
      title: title ?? this.title,
      direction: direction ?? this.direction,
      padding: padding ?? this.padding,
      position: position ?? this.position,
      offset: offset ?? this.offset,
      spacing: spacing ?? this.spacing,
      textStyle: textStyle ?? this.textStyle,
      segmentSize: segmentSize ?? segmentSize,
      overflowMode: overflowMode ?? this.overflowMode,
      labelsPlacement: labelsPlacement ?? this.labelsPlacement,
      edgeLabelsPlacement: edgeLabelsPlacement ?? this.edgeLabelsPlacement,
      labelOverflow: labelOverflow ?? this.labelOverflow,
      segmentPaintingStyle: segmentPaintingStyle ?? this.segmentPaintingStyle,
      showPointerOnHover: showPointerOnHover ?? this.showPointerOnHover,
      pointerBuilder: pointerBuilder ?? this.pointerBuilder,
      pointerColor: pointerColor ?? this.pointerColor,
      pointerSize: pointerSize ?? this.pointerSize,
    );
  }
}