| 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 '../editing/editable_string.dart'; | 5 import '../editing/editable_string.dart'; |
| 6 import '../editing/editable_text.dart'; | 6 import '../editing/editable_text.dart'; |
| 7 import '../editing/keyboard.dart'; | 7 import '../editing/keyboard.dart'; |
| 8 import '../fn.dart'; | 8 import '../fn.dart'; |
| 9 import '../theme/colors.dart'; | 9 import '../theme/colors.dart'; |
| 10 | 10 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 Input({Object key, | 45 Input({Object key, |
| 46 this.placeholder, | 46 this.placeholder, |
| 47 this.onChanged, | 47 this.onChanged, |
| 48 this.focused}) | 48 this.focused}) |
| 49 : super(key: key, stateful: true) { | 49 : super(key: key, stateful: true) { |
| 50 _editableValue = new EditableString(text: _value, | 50 _editableValue = new EditableString(text: _value, |
| 51 onUpdated: _handleTextUpdated); | 51 onUpdated: _handleTextUpdated); |
| 52 } | 52 } |
| 53 | 53 |
| 54 void _handleTextUpdated() { | 54 void _handleTextUpdated() { |
| 55 setState(() {}); | 55 scheduleBuild(); |
| 56 if (_value != _editableValue.text) { | 56 if (_value != _editableValue.text) { |
| 57 _value = _editableValue.text; | 57 _value = _editableValue.text; |
| 58 if (onChanged != null) | 58 if (onChanged != null) |
| 59 onChanged(_value); | 59 onChanged(_value); |
| 60 } | 60 } |
| 61 } | 61 } |
| 62 | 62 |
| 63 void didUnmount() { | 63 void didUnmount() { |
| 64 if (_isAttachedToKeyboard) | 64 if (_isAttachedToKeyboard) |
| 65 keyboard.hide(); | 65 keyboard.hide(); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 82 | 82 |
| 83 children.add(new EditableText(value: _editableValue, focused: focused)); | 83 children.add(new EditableText(value: _editableValue, focused: focused)); |
| 84 | 84 |
| 85 return new Container( | 85 return new Container( |
| 86 style: _style, | 86 style: _style, |
| 87 inlineStyle: focused ? _focusedInlineStyle : null, | 87 inlineStyle: focused ? _focusedInlineStyle : null, |
| 88 children: children | 88 children: children |
| 89 ); | 89 ); |
| 90 } | 90 } |
| 91 } | 91 } |
| OLD | NEW |