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 'dart:async'; | 5 import 'dart:async'; |
6 | 6 |
7 import '../widgets/basic.dart'; | 7 import '../widgets/basic.dart'; |
8 import 'editable_string.dart'; | 8 import 'editable_string.dart'; |
9 | 9 |
10 class EditableText extends Component { | 10 class EditableText extends Component { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 _stopCursorTimer(); | 51 _stopCursorTimer(); |
52 super.didUnmount(); | 52 super.didUnmount(); |
53 } | 53 } |
54 | 54 |
55 void _stopCursorTimer() { | 55 void _stopCursorTimer() { |
56 _cursorTimer.cancel(); | 56 _cursorTimer.cancel(); |
57 _cursorTimer = null; | 57 _cursorTimer = null; |
58 _showCursor = false; | 58 _showCursor = false; |
59 } | 59 } |
60 | 60 |
61 UINode build() { | 61 Widget build() { |
62 if (focused && _cursorTimer == null) | 62 if (focused && _cursorTimer == null) |
63 _startCursorTimer(); | 63 _startCursorTimer(); |
64 else if (!focused && _cursorTimer != null) | 64 else if (!focused && _cursorTimer != null) |
65 _stopCursorTimer(); | 65 _stopCursorTimer(); |
66 | 66 |
67 //List<UINode> children = new List<UINode>(); | 67 //List<Widget> children = new List<Widget>(); |
68 String hack = ""; | 68 String hack = ""; |
69 | 69 |
70 if (!value.composing.isValid) { | 70 if (!value.composing.isValid) { |
71 // children.add(new TextFragment(value.text)); | 71 // children.add(new TextFragment(value.text)); |
72 hack += value.text; | 72 hack += value.text; |
73 } else { | 73 } else { |
74 hack += value.textBefore(value.composing); | 74 hack += value.textBefore(value.composing); |
75 hack += value.textInside(value.composing); | 75 hack += value.textInside(value.composing); |
76 hack += value.textAfter(value.composing); | 76 hack += value.textAfter(value.composing); |
77 // if (!composing.isEmpty) { | 77 // if (!composing.isEmpty) { |
(...skipping 13 matching lines...) Expand all Loading... |
91 // children.add(new Container( | 91 // children.add(new Container( |
92 // key: 'cursor', | 92 // key: 'cursor', |
93 // // style: _cursorStyle | 93 // // style: _cursorStyle |
94 // )); | 94 // )); |
95 | 95 |
96 return new Paragraph( | 96 return new Paragraph( |
97 text: hack | 97 text: hack |
98 ); | 98 ); |
99 } | 99 } |
100 } | 100 } |
OLD | NEW |