| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 import 'package:vector_math/vector_math.dart'; | 5 import 'package:vector_math/vector_math.dart'; |
| 6 | 6 |
| 7 import '../rendering/block.dart'; | 7 import '../rendering/block.dart'; |
| 8 import '../rendering/box.dart'; | 8 import '../rendering/box.dart'; |
| 9 import '../rendering/flex.dart'; | 9 import '../rendering/flex.dart'; |
| 10 import '../rendering/object.dart'; | 10 import '../rendering/object.dart'; |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 root.alignItems = alignItems; | 338 root.alignItems = alignItems; |
| 339 } | 339 } |
| 340 | 340 |
| 341 } | 341 } |
| 342 | 342 |
| 343 class Flexible extends ParentDataNode { | 343 class Flexible extends ParentDataNode { |
| 344 Flexible({ String key, Widget child, int flex: 1 }) | 344 Flexible({ String key, Widget child, int flex: 1 }) |
| 345 : super(child, new FlexBoxParentData()..flex = flex, key: key); | 345 : super(child, new FlexBoxParentData()..flex = flex, key: key); |
| 346 } | 346 } |
| 347 | 347 |
| 348 class Paragraph extends RenderObjectWrapper { | 348 class Inline extends RenderObjectWrapper { |
| 349 | 349 Inline({ Object key, this.text }) : super(key: key); |
| 350 Paragraph({ String key, this.text, this.style }) : super(key: key); | |
| 351 | 350 |
| 352 RenderParagraph get root => super.root; | 351 RenderParagraph get root => super.root; |
| 353 RenderParagraph createNode() => new RenderParagraph(text: text, style: style); | 352 RenderParagraph createNode() => new RenderParagraph(text); |
| 354 | 353 |
| 355 final String text; | 354 final InlineBase text; |
| 356 final TextStyle style; | |
| 357 | 355 |
| 358 void syncRenderObject(Widget old) { | 356 void syncRenderObject(Widget old) { |
| 359 super.syncRenderObject(old); | 357 super.syncRenderObject(old); |
| 360 root.text = text; | 358 root.inline = text; |
| 361 root.style = style; | |
| 362 } | 359 } |
| 363 | 360 |
| 364 void insert(RenderObjectWrapper child, dynamic slot) { | 361 void insert(RenderObjectWrapper child, dynamic slot) { |
| 365 assert(false); | 362 assert(false); |
| 366 // Paragraph does not support having children currently | 363 // Inline does not support having children currently |
| 367 } | 364 } |
| 368 | 365 |
| 369 } | 366 } |
| 370 | 367 |
| 371 class Text extends Component { | 368 class Text extends Component { |
| 372 Text(this.data, { TextStyle this.style }) : super(key: '*text*'); | 369 Text(this.data, { TextStyle this.style }) : super(key: '*text*'); |
| 373 final String data; | 370 final String data; |
| 374 final TextStyle style; | 371 final TextStyle style; |
| 375 bool get interchangeable => true; | 372 bool get interchangeable => true; |
| 376 Widget build() => new Paragraph(text: data, style: style); | 373 Widget build() { |
| 374 InlineBase text = new InlineText(data); |
| 375 if (style != null) text = new InlineStyle(style, [text]); |
| 376 return new Inline(text: text); |
| 377 } |
| 377 } | 378 } |
| 378 | 379 |
| 379 class Image extends RenderObjectWrapper { | 380 class Image extends RenderObjectWrapper { |
| 380 | 381 |
| 381 Image({ | 382 Image({ |
| 382 String key, | 383 String key, |
| 383 this.src, | 384 this.src, |
| 384 this.size | 385 this.size |
| 385 }) : super(key: key); | 386 }) : super(key: key); |
| 386 | 387 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 } | 423 } |
| 423 } | 424 } |
| 424 | 425 |
| 425 void insert(RenderObjectWrapper child, dynamic slot) { | 426 void insert(RenderObjectWrapper child, dynamic slot) { |
| 426 assert(false); | 427 assert(false); |
| 427 // WidgetToRenderBoxAdapter cannot have Widget children; by | 428 // WidgetToRenderBoxAdapter cannot have Widget children; by |
| 428 // definition, it is the transition out of the Widget world. | 429 // definition, it is the transition out of the Widget world. |
| 429 } | 430 } |
| 430 | 431 |
| 431 } | 432 } |
| OLD | NEW |