Skip to content

Instantly share code, notes, and snippets.

@Bharathh-Raj
Created July 22, 2021 12:18
Show Gist options
  • Save Bharathh-Raj/a1ad713c935839cf292247d7326316b4 to your computer and use it in GitHub Desktop.
Save Bharathh-Raj/a1ad713c935839cf292247d7326316b4 to your computer and use it in GitHub Desktop.
void _drawHourText({required Canvas canvas, required int minute, required double theta}) {
final double fontSize = 12.0;
TextSpan span =
new TextSpan(style: new TextStyle(color: Colors.white, fontSize: fontSize), text: (minute ~/ 5).toString());
TextPainter tp = new TextPainter(
text: span,
textAlign: TextAlign.center,
textDirection: TextDirection.ltr,
);
tp.layout();
final Offset _pointToPositionText =
GetOffset.getOffsetWithRadiusAndTheta(radius: _getInnerPointRadiusOfMinuteLine(minute) - 12, theta: theta);
tp.paint(canvas, Offset(_pointToPositionText.dx - tp.width / 2, _pointToPositionText.dy - tp.height / 2));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment