copyWith method
ChartContext
copyWith({
- ChartConfig? config,
- ChartTheme? theme,
- ChartBounds? bounds,
- ChartViewport? viewport,
- CoordinateTransformer? transformer,
- PaintCache? paintCache,
- double? animationValue,
- ChartHitResult? hoveredHit,
- ChartHitResult? selectedHit,
- Offset? crosshairPosition,
- ZoomPanController? zoomPan,
- bool clearHover = false,
- bool clearSelection = false,
- bool clearCrosshair = false,
Implementation
ChartContext copyWith({
ChartConfig? config,
ChartTheme? theme,
ChartBounds? bounds,
ChartViewport? viewport,
CoordinateTransformer? transformer,
PaintCache? paintCache,
double? animationValue,
ChartHitResult? hoveredHit,
ChartHitResult? selectedHit,
Offset? crosshairPosition,
ZoomPanController? zoomPan,
bool clearHover = false,
bool clearSelection = false,
bool clearCrosshair = false,
}) {
return ChartContext(
config: config ?? this.config,
theme: theme ?? this.theme,
bounds: bounds ?? this.bounds,
viewport: viewport ?? this.viewport,
transformer: transformer ?? this.transformer,
paintCache: paintCache ?? this.paintCache,
animationValue: animationValue ?? this.animationValue,
hoveredHit: clearHover ? null : (hoveredHit ?? this.hoveredHit),
selectedHit: clearSelection ? null : (selectedHit ?? this.selectedHit),
crosshairPosition: clearCrosshair
? null
: (crosshairPosition ?? this.crosshairPosition),
zoomPan: zoomPan ?? this.zoomPan,
);
}