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:
@@ -97,9 +97,9 @@ class RenderDots extends RenderBox {
|
||||
void main() {
|
||||
// Create some styled text to tell the user to interact with the app.
|
||||
RenderParagraph paragraph = new RenderParagraph(
|
||||
new StyledTextSpan(
|
||||
new TextStyle(color: Colors.black87),
|
||||
<TextSpan>[ new PlainTextSpan("Touch me!") ]
|
||||
new TextSpan(
|
||||
style: new TextStyle(color: Colors.black87),
|
||||
text: "Touch me!"
|
||||
)
|
||||
);
|
||||
// A stack is a render object that layers its children on top of each other.
|
||||
|
||||
Reference in New Issue
Block a user