render method
Implementation
void render(Canvas c) {
if (_rectBackgroundDirection != null && _dragging && enableDirection) {
if (spriteBackgroundDirection == null) {
_paintBackground?.let((paintBackground) {
double radiusBackground = _rectBackgroundDirection!.rect.width / 2;
c.drawCircle(
Offset(
_rectBackgroundDirection!.rect.left + radiusBackground,
_rectBackgroundDirection!.rect.top + radiusBackground,
),
radiusBackground,
paintBackground,
);
});
} else {
spriteBackgroundDirection?.renderFromVector2Rect(
c,
_rectBackgroundDirection!,
);
}
}
_rect?.let((rect) {
if (_spriteToRender != null) {
_spriteToRender?.render(
c,
position: rect.position,
size: rect.size,
);
} else {
double radiusAction = rect.width / 2;
c.drawCircle(
Offset(
rect.left + radiusAction,
rect.top + radiusAction,
),
radiusAction,
(isPressed ? _paintActionPressed : _paintAction) ?? Paint(),
);
}
});
}