copyWith method
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,
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,
);
}
}