Chromium Code Reviews| Index: sky/sdk/lib/editing/editable_text.dart |
| diff --git a/sky/sdk/lib/editing/editable_text.dart b/sky/sdk/lib/editing/editable_text.dart |
| index 3f5bea54884534448e2ab5545ff4a9dfd3a35499..ecc5fc779f51538a217ac7e39a8668896a3ceb4b 100644 |
| --- a/sky/sdk/lib/editing/editable_text.dart |
| +++ b/sky/sdk/lib/editing/editable_text.dart |
| @@ -4,6 +4,7 @@ |
| import 'dart:async'; |
| +import '../painting/text_style.dart'; |
| import '../widgets/basic.dart'; |
| import 'editable_string.dart'; |
| @@ -19,9 +20,8 @@ class EditableText extends Component { |
| // background-color: ${Blue[500]};''' |
| // ); |
| - // static final Style _composingStyle = new Style(''' |
| - // text-decoration: underline;''' |
| - // ); |
| + static const TextStyle _plainStyle = const TextStyle(); |
|
Hixie
2015/06/19 22:39:44
Can't this be null?
hansmuller
2015/06/19 23:32:11
Not at the moment (StyledText doesn't support that
|
| + static const TextStyle _composingStyle = const TextStyle(decoration: underline); |
|
abarth-chromium
2015/06/19 22:41:38
I would just inline these in the one place they're
hansmuller
2015/06/19 23:32:11
Done.
|
| EditableString value; |
| bool focused; |
| @@ -64,35 +64,15 @@ class EditableText extends Component { |
| else if (!focused && _cursorTimer != null) |
| _stopCursorTimer(); |
| - //List<Widget> children = new List<Widget>(); |
| - String hack = ""; |
| - |
| if (!value.composing.isValid) { |
| - // children.add(new TextFragment(value.text)); |
| - hack += value.text; |
| - } else { |
| - hack += value.textBefore(value.composing); |
| - hack += value.textInside(value.composing); |
| - hack += value.textAfter(value.composing); |
| - // if (!composing.isEmpty) { |
| - // children.add(new TextFragment( |
| - // composing, |
| - // key: 'composing', |
| - // style: _composingStyle |
| - // )); |
| - // } |
| - |
| - // String afterComposing = value.textAfter(value.composing); |
| - // if (!afterComposing.isEmpty) |
| - // children.add(new TextFragment(afterComposing)); |
| + return new Text(value.text); |
| } |
| - // if (_showCursor) |
| - // children.add(new Container( |
| - // key: 'cursor', |
| - // // style: _cursorStyle |
| - // )); |
| - |
| - return new Text(hack); |
| + return new StyledText(elements: [ |
| + _plainStyle, |
| + value.textBefore(value.composing), |
| + [_composingStyle, value.textInside(value.composing)], |
| + value.textAfter(value.composing) |
| + ]); |
| } |
| } |