builder method
Implementation
@override
BasePainter builder(BuildContext context) {
final data = watchController();
double average = 0;
if (data is AceStockMetricController && data.average != null) {
average = data.average!;
}
final painter = KChartPainter(
transformTime: widget.transformTime,
showCrossText: widget.showCrossText,
pointSpace: data.getSpace(),
scrollX: data.getScrollX(),
scale: data.getScale(),
pressOffset: data.getPressOffset(),
average: average,
averageLineColor: widget.averageLineColor,
values: data.values,
pointWidth: data.pointWidth,
paddingTop: widget.paddingTop,
gridLineWidth: widget.gridLineWidth,
gridLineColor: widget.gridLineColor,
gridHorizontalGrids: widget.gridHorizontalGrids,
gridTextStyle: widget.gridTextStyle,
gridVerticalGrids: widget.gridVerticalGrids,
gridUpperStyle: widget.gridUpperStyle,
gridlowerStyle: widget.gridlowerStyle,
horizontalTextStyle: widget.horizontalTextStyle,
crossLineColor: widget.crossLineColor,
crossLineWidth: widget.crossLineWidth,
crossTextBgColor: widget.crossTextBgColor,
crossTextBorderColor: widget.crossTextBorderColor,
crossLowerTextStyle: widget.crossLowerTextStyle,
crossUpperTextStyle: widget.crossUpperTextStyle,
maDayColors: widget.maDayColors,
strokeWidth: widget.strokeWidth,
maStrokeWidth: widget.maStrokeWidth,
upperColor: widget.upperColor,
upperStyle: widget.upperStyle,
lowerColor: widget.lowerColor,
lowerStyle: widget.lowerStyle,
onDrawCross: (
index,
alignment,
pressOffset,
) {
if (_crossIndex == index) {
return;
}
_crossIndex = index;
HapticFeedback.selectionClick();
if (widget.onCrossChange == null) {
return;
}
widget.onCrossChange!(index, alignment);
},
highMarkColor: widget.highMarkColor,
lowMarkColor: widget.lowMarkColor,
markSize: widget.markSize);
return painter;
}