defaultDrawNormal function

void defaultDrawNormal(
  1. DateModel dateModel,
  2. Canvas canvas,
  3. Size size
)

默认的样式

Implementation

void defaultDrawNormal(DateModel dateModel, Canvas canvas, Size size) {
  //顶部的文字
  TextPainter dayTextPainter = new TextPainter()
    ..text = TextSpan(
        text: dateModel.day.toString(),
        style: dateModel.isCurrentDay
            ? currentDayTextStyle
            : currentMonthTextStyle)
    ..textDirection = TextDirection.ltr
    ..textAlign = TextAlign.center;

  dayTextPainter.layout(minWidth: size.width, maxWidth: size.width);
  dayTextPainter.paint(canvas, Offset(0, 10));

  //下面的文字
  TextPainter lunarTextPainter = new TextPainter()
    ..text = new TextSpan(text: dateModel.lunarString, style: lunarTextStyle)
    ..textDirection = TextDirection.ltr
    ..textAlign = TextAlign.center;

  lunarTextPainter.layout(minWidth: size.width, maxWidth: size.width);
  lunarTextPainter.paint(canvas, Offset(0, size.height / 2));
}