ClockPainter constructor

ClockPainter(
  1. DateTime datetime, {
  2. double radius = 150.0,
  3. Color handColor = Colors.black,
  4. Color numberColor = Colors.black,
  5. Color borderColor = Colors.black,
  6. Color color = Colors.red,
  7. double strokeWidth = 1.0,
})

Implementation

ClockPainter(this.datetime,
    {this.radius = 150.0,
    this.handColor = Colors.black,
    this.numberColor = Colors.black,
    this.borderColor = Colors.black,
    Color color = Colors.red,
    double strokeWidth = 1.0})
    : super(color: color, strokeWidth: strokeWidth) {
  borderWidth = radius / 14;

  final secondDistance = radius - borderWidth * 2;
  for (var i = 0; i < 60; i++) {
    Offset offset = Offset(
        cos(degToRad(6 * i - 90)) * secondDistance + radius,
        sin(degToRad(6 * i - 90)) * secondDistance + radius);
    secondsOffset.add(offset);
  }
  textPainter = TextPainter(
    textAlign: TextAlign.center,
    textDirection: TextDirection.rtl,
  );
  angle = degToRad(360 / 60).toDouble();
}