refactor!: Kill TextRenderer, Long Live TextRenderer (#2683)

This will:

    kill the TextRenderer inheritance chain
    incorporate the functionality of the base TextRenderer in the base TextFormatter
    rename TextFormatter to TextRenderer and appropriate references

That is because both essentially do the same job; encompass the style (or "how") information about how to render text, but using two slightly different interfaces. While that could allow for more flexibility, it is a faux choice that needlessly complicates the pipeline. By having a single interface to comply with, we still allow for custom renders while at the same time making all the code downstream simpler to use and understand.
This commit is contained in:
Luan Nico
2023-08-27 12:47:01 -07:00
committed by GitHub
parent 88d3270e2f
commit a1cb9a06ad
25 changed files with 355 additions and 268 deletions

View File

@ -208,7 +208,7 @@ class MyKeyboardDetector extends HardwareKeyboardDetector
class KeyboardKey extends PositionComponent {
KeyboardKey({required this.text, super.position}) {
textElement = textRenderer.formatter.format(text);
textElement = textRenderer.format(text);
width = textElement.metrics.width + padding.x;
height = textElement.metrics.height + padding.y;
textElement.translate(