| 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 '../painting/text_style.dart'; | 5 import '../painting/text_style.dart'; |
| 6 import '../widgets/basic.dart'; | 6 import '../widgets/basic.dart'; |
| 7 import '../widgets/theme.dart'; | 7 import '../widgets/theme.dart'; |
| 8 import 'editable_string.dart'; | 8 import 'editable_string.dart'; |
| 9 import 'editable_text.dart'; | 9 import 'editable_text.dart'; |
| 10 import 'keyboard.dart'; | 10 import 'keyboard.dart'; |
| 11 | 11 |
| 12 typedef void ValueChanged(value); | 12 typedef void ValueChanged(value); |
| 13 | 13 |
| 14 const double _kHintOpacity = 0.26; | 14 const double _kHintOpacity = 0.26; |
| 15 const EdgeDims _kTextfieldPadding = const EdgeDims.symmetric(vertical: 8.0); | 15 const EdgeDims _kTextfieldPadding = const EdgeDims.symmetric(vertical: 8.0); |
| 16 | 16 |
| 17 class Input extends Component { | 17 class Input extends StatefulComponent { |
| 18 | 18 |
| 19 Input({String key, | 19 Input({String key, |
| 20 this.placeholder, | 20 this.placeholder, |
| 21 this.onChanged, | 21 this.onChanged, |
| 22 this.focused}) | 22 this.focused}) |
| 23 : super(key: key, stateful: true) { | 23 : super(key: key) { |
| 24 _editableValue = new EditableString( | 24 _editableValue = new EditableString( |
| 25 text: _value, | 25 text: _value, |
| 26 onUpdated: _handleTextUpdated | 26 onUpdated: _handleTextUpdated |
| 27 ); | 27 ); |
| 28 } | 28 } |
| 29 | 29 |
| 30 String placeholder; | 30 String placeholder; |
| 31 ValueChanged onChanged; | 31 ValueChanged onChanged; |
| 32 bool focused = false; | 32 bool focused = false; |
| 33 | 33 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 onPointerDown: (_) => keyboard.showByRequest() | 99 onPointerDown: (_) => keyboard.showByRequest() |
| 100 ); | 100 ); |
| 101 } | 101 } |
| 102 | 102 |
| 103 void didUnmount() { | 103 void didUnmount() { |
| 104 if (_isAttachedToKeyboard) | 104 if (_isAttachedToKeyboard) |
| 105 keyboard.hide(); | 105 keyboard.hide(); |
| 106 super.didUnmount(); | 106 super.didUnmount(); |
| 107 } | 107 } |
| 108 } | 108 } |
| OLD | NEW |