drawSelectView method
Implementation
void drawSelectView(Canvas canvas, int index, bool isLeft) {
DepthEntity entity = isLeft ? mBuyData![index] : mSellData![index];
double dx = isLeft ? getBuyX(index) : getSellX(index);
double dy = getY(entity.vol);
double radius = 8.0;
if (dx < mDrawWidth) {
canvas.drawCircle(Offset(dx, dy), radius / 3,
mBuyLinePaint!..style = PaintingStyle.fill);
canvas.drawCircle(
Offset(dx, dy), radius, mBuyLinePaint!..style = PaintingStyle.stroke);
} else {
canvas.drawCircle(Offset(dx, dy), radius / 3,
mSellLinePaint!..style = PaintingStyle.fill);
canvas.drawCircle(Offset(dx, dy), radius,
mSellLinePaint!..style = PaintingStyle.stroke);
}
///draw popup info
///
_PopupPainter popupPainter = _PopupPainter(
chartTranslations: this.chartTranslations,
chartColors: this.chartColors,
price: entity.price.toStringAsFixed(fixedLength!),
amount: entity.vol.toStringAsFixed(fixedLength!),
);
dx = dx < mDrawWidth ? dx + offset.dx : dx - offset.dx - popupPainter.width;
dy = dy < mDrawHeight / 2
? dy + offset.dy
: dy - offset.dy - popupPainter.height;
Rect rect = Rect.fromLTWH(dx, dy, popupPainter.width, popupPainter.height);
RRect boxRect = RRect.fromRectAndRadius(rect, Radius.circular(2.5));
canvas.drawRRect(boxRect, selectPaint!);
canvas.drawRRect(boxRect, selectBorderPaint!);
popupPainter.paint(canvas, rect.topLeft);
}