drawWhiteText method Null safety

  1. @override
void drawWhiteText(
  1. Canvas canvas,
  2. TextStyle style,
  3. String text,
  4. double w
)
override

Implementation

@override
void drawWhiteText(Canvas canvas, TextStyle style, String text, double w) {
  if (bFactory.controller.model.onIsPressed.value) {
    canvas.save();
    // The translate values are super hacky - I really should be calculating
    // font metrics on the strings.  But I'm also using a bundled font, so
    // just using values obtained from trial and error like this is pretty
    // safe.
    canvas.translate(0, -14);
    super.drawWhiteText(canvas, style, text, w);
    canvas.translate(14, 81);
    canvas.scale(0.5);
    super.drawCustomWhiteText(canvas, '+ SAVE', w);
    canvas.restore();
  } else {
    super.drawWhiteText(canvas, style, text, w);
  }
}