drawTopAndTextPhase method
void
drawTopAndTextPhase()
Draw top view and inside background
Implementation
void drawTopAndTextPhase(
Canvas canvas,
Rect rect,
Offset center,
double radius,
int startDay,
int endDay,
Color topColor,
Color bgColor,
String label,
Color textColor) {
final startAngle = (2 * pi / totalCycleDays) * startDay - pi / 2;
final sweepAngle = (2 * pi / totalCycleDays) * (endDay - startDay);
///Draw top view
if (theme == MenstrualCycleTheme.arcs) {
final paint = Paint()
..color = topColor
..style = PaintingStyle.stroke
..strokeWidth = arcStrokeWidth; // Manage Height of Outer circle
canvas.drawArc(
Rect.fromCircle(center: center, radius: radius),
startAngle,
sweepAngle,
false,
paint,
);
}
if (!isRemoveBackgroundPhaseColor) {
/// Draw background color based on phase
final paint1 = Paint()
..color = bgColor
..style = PaintingStyle.fill;
canvas.drawArc(rect, startAngle, sweepAngle, true, paint1);
}
/// set text inside circle
if (phaseTextBoundaries != PhaseTextBoundaries.none) {
if (phaseTextBoundaries == PhaseTextBoundaries.both ||
phaseTextBoundaries == PhaseTextBoundaries.inside) {
drawPhaseTextInside(
canvas, center, radius, startDay, endDay, textColor, label);
}
}
}