Improve TextSpan
Now we just have one TextSpan class that handles both simple strings, trees of children, and styling both. This approach simplifies the interface for most clients. This patch also removes StyledText, which was weakly typed and tricky to use correctly. The replacement is RichText, which is strongly typed and uses TextSpan.
This commit is contained in:
@@ -35,9 +35,7 @@ class Label extends Node {
|
||||
|
||||
void paint(Canvas canvas) {
|
||||
if (_painter == null) {
|
||||
PlainTextSpan textSpan = new PlainTextSpan(_text);
|
||||
StyledTextSpan styledTextSpan = new StyledTextSpan(_textStyle, <TextSpan>[textSpan]);
|
||||
_painter = new TextPainter(styledTextSpan);
|
||||
_painter = new TextPainter(new TextSpan(style: _textStyle, text: _text));
|
||||
|
||||
_painter.maxWidth = double.INFINITY;
|
||||
_painter.minWidth = 0.0;
|
||||
|
||||
Reference in New Issue
Block a user