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

Unified Diff: sky/sdk/lib/editing/editable_text.dart

Issue 1194113002: EditableText underlines the word being edited (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: do not constrain the input components width 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 | « no previous file | sky/sdk/lib/editing/input.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..d49b410a1099c4d14535a05bed2d1d3ec456eec2 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,10 +20,6 @@ class EditableText extends Component {
// background-color: ${Blue[500]};'''
// );
- // static final Style _composingStyle = new Style('''
- // text-decoration: underline;'''
- // );
-
EditableString value;
bool focused;
@@ -64,35 +61,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: [
+ const TextStyle(),
+ value.textBefore(value.composing),
+ [const TextStyle(decoration: underline), value.textInside(value.composing)],
+ value.textAfter(value.composing)
+ ]);
}
}
« no previous file with comments | « no previous file | sky/sdk/lib/editing/input.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698