| Index: sky/sdk/lib/framework/editing2/editable_text.dart
|
| diff --git a/sky/sdk/lib/framework/editing2/editable_text.dart b/sky/sdk/lib/framework/editing2/editable_text.dart
|
| index 711e930360c196665a5ddd2f588849160132047a..430933bf997d0d2f117bf3c76fa46ac95797911c 100644
|
| --- a/sky/sdk/lib/framework/editing2/editable_text.dart
|
| +++ b/sky/sdk/lib/framework/editing2/editable_text.dart
|
| @@ -9,6 +9,9 @@ import 'editable_string.dart';
|
|
|
| class EditableText extends Component {
|
|
|
| + EditableText({Object key, this.value, this.focused})
|
| + : super(key: key, stateful: true);
|
| +
|
| // static final Style _cursorStyle = new Style('''
|
| // width: 2px;
|
| // height: 1.2em;
|
| @@ -22,17 +25,15 @@ class EditableText extends Component {
|
|
|
| EditableString value;
|
| bool focused;
|
| - Timer _cursorTimer;
|
| - bool _showCursor = false;
|
|
|
| - EditableText({Object key, this.value, this.focused})
|
| - : super(key: key, stateful: true) {
|
| - onDidUnmount(() {
|
| - if (_cursorTimer != null)
|
| - _stopCursorTimer();
|
| - });
|
| + void syncFields(EditableText source) {
|
| + value = source.value;
|
| + focused = source.focused;
|
| }
|
|
|
| + Timer _cursorTimer;
|
| + bool _showCursor = false;
|
| +
|
| void _cursorTick(Timer timer) {
|
| setState(() {
|
| _showCursor = !_showCursor;
|
| @@ -45,6 +46,12 @@ class EditableText extends Component {
|
| new Duration(milliseconds: 500), _cursorTick);
|
| }
|
|
|
| + void didUnmount() {
|
| + if (_cursorTimer != null)
|
| + _stopCursorTimer();
|
| + super.didUnmount();
|
| + }
|
| +
|
| void _stopCursorTimer() {
|
| _cursorTimer.cancel();
|
| _cursorTimer = null;
|
|
|