Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(825)

Unified Diff: sky/sdk/lib/widgets/basic.dart

Issue 1177833012: Styling for text fragments (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Merge Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/sdk/lib/rendering/paragraph.dart ('k') | sky/tests/framework/stocks-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/sdk/lib/widgets/basic.dart
diff --git a/sky/sdk/lib/widgets/basic.dart b/sky/sdk/lib/widgets/basic.dart
index 68b4f73631761e976b76c47e8c77dfb48cbff444..0681eb17ec85287dadbb9a356f47c027d8a90ad6 100644
--- a/sky/sdk/lib/widgets/basic.dart
+++ b/sky/sdk/lib/widgets/basic.dart
@@ -345,25 +345,22 @@ class Flexible extends ParentDataNode {
: super(child, new FlexBoxParentData()..flex = flex, key: key);
}
-class Paragraph extends RenderObjectWrapper {
-
- Paragraph({ String key, this.text, this.style }) : super(key: key);
+class Inline extends RenderObjectWrapper {
+ Inline({ Object key, this.text }) : super(key: key);
RenderParagraph get root => super.root;
- RenderParagraph createNode() => new RenderParagraph(text: text, style: style);
+ RenderParagraph createNode() => new RenderParagraph(text);
- final String text;
- final TextStyle style;
+ final InlineBase text;
void syncRenderObject(Widget old) {
super.syncRenderObject(old);
- root.text = text;
- root.style = style;
+ root.inline = text;
}
void insert(RenderObjectWrapper child, dynamic slot) {
assert(false);
- // Paragraph does not support having children currently
+ // Inline does not support having children currently
}
}
@@ -373,7 +370,11 @@ class Text extends Component {
final String data;
final TextStyle style;
bool get interchangeable => true;
- Widget build() => new Paragraph(text: data, style: style);
+ Widget build() {
+ InlineBase text = new InlineText(data);
+ if (style != null) text = new InlineStyle(style, [text]);
+ return new Inline(text: text);
+ }
}
class Image extends RenderObjectWrapper {
« no previous file with comments | « sky/sdk/lib/rendering/paragraph.dart ('k') | sky/tests/framework/stocks-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698