drawRightSelectView method
void
drawRightSelectView(
- Canvas canvas,
- int index
)
Implementation
void drawRightSelectView(Canvas canvas, int index) {
DepthEntity entity = mSellData![index];
double dx = getSellX(index);
double dy = getY(entity.vol);
/// draw overlay barrier model
canvas.drawRect(
Rect.fromLTRB(dx, 0, mWidth, mDrawHeight),
mBarrierPathPaint!,
);
/// draw cross line
canvas.drawDashLine(
Offset(dx, 0),
Offset(dx, mDrawHeight),
crossPaint ?? Paint(),
);
/// draw dot
canvas.drawCircle(
Offset(dx, dy),
chartStyle.dotRadius * .6,
mSellLinePaint!..style = PaintingStyle.fill,
);
canvas.drawCircle(
Offset(dx, dy),
chartStyle.dotRadius,
mSellLinePaint!..style = PaintingStyle.stroke,
);
///draw popup info
///
_PopupPainter popupPainter = _PopupPainter(
translations: this.chartTranslations,
chartColors: this.chartColors,
chartStyle: this.chartStyle,
price: NumberUtil.format(entity.price, quoteUnit) ?? '',
amount: NumberUtil.formatCompact(entity.vol, baseUnit),
);
dx = dx < mWidth * 0.75
? dx + offset.dx
: dx - offset.dx - popupPainter.width;
// dx = dx + offset.dx;
// dy = dy < mDrawHeight / 2
// ? dy + offset.dy
// : dy - offset.dy - popupPainter.height;
dy = (dy - popupPainter.height / 2)
.clamp(offset.dy, mDrawHeight - popupPainter.height - offset.dy);
Rect rect = Rect.fromLTWH(dx, dy, popupPainter.width, popupPainter.height);
RRect boxRect =
RRect.fromRectAndRadius(rect, Radius.circular(chartStyle.radius));
canvas.drawRRect(boxRect, selectPaint!);
canvas.drawRRect(boxRect, selectBorderPaint!);
popupPainter.paint(canvas, rect.topLeft);
}