| 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 '../editing2/editable_string.dart'; | 5 import '../editing2/editable_string.dart'; |
| 6 import '../editing2/editable_text.dart'; | 6 import '../editing2/editable_text.dart'; |
| 7 import '../editing2/keyboard.dart'; | 7 import '../editing2/keyboard.dart'; |
| 8 import '../fn2.dart'; | 8 import '../fn2.dart'; |
| 9 import '../theme2/colors.dart'; | 9 import '../theme2/colors.dart'; |
| 10 import '../theme2/typography.dart' as typography; | 10 import '../theme2/typography.dart' as typography; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 // top: 8px; | 43 // top: 8px; |
| 44 // left: 8px; | 44 // left: 8px; |
| 45 // position: absolute; | 45 // position: absolute; |
| 46 // ${typography.black.caption};''' | 46 // ${typography.black.caption};''' |
| 47 // ); | 47 // ); |
| 48 | 48 |
| 49 // static final String _focusedInlineStyle = ''' | 49 // static final String _focusedInlineStyle = ''' |
| 50 // padding: 7px; | 50 // padding: 7px; |
| 51 // border-bottom: 2px solid ${Blue[500]};'''; | 51 // border-bottom: 2px solid ${Blue[500]};'''; |
| 52 | 52 |
| 53 String placeholder; |
| 53 ValueChanged onChanged; | 54 ValueChanged onChanged; |
| 54 String placeholder; | |
| 55 bool focused = false; | 55 bool focused = false; |
| 56 | 56 |
| 57 void syncFields(Input source) { |
| 58 placeholder = source.placeholder; |
| 59 onChanged = source.onChanged; |
| 60 focused = source.focused; |
| 61 super.syncFields(source); |
| 62 } |
| 63 |
| 57 String _value = ''; | 64 String _value = ''; |
| 58 bool _isAttachedToKeyboard = false; | 65 bool _isAttachedToKeyboard = false; |
| 59 EditableString _editableValue; | 66 EditableString _editableValue; |
| 60 | 67 |
| 61 void _handleTextUpdated() { | 68 void _handleTextUpdated() { |
| 62 scheduleBuild(); | 69 scheduleBuild(); |
| 63 if (_value != _editableValue.text) { | 70 if (_value != _editableValue.text) { |
| 64 _value = _editableValue.text; | 71 _value = _editableValue.text; |
| 65 if (onChanged != null) | 72 if (onChanged != null) |
| 66 onChanged(_value); | 73 onChanged(_value); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 89 direction: FlexDirection.vertical, | 96 direction: FlexDirection.vertical, |
| 90 // style: _style, | 97 // style: _style, |
| 91 // inlineStyle: focused ? _focusedInlineStyle : null, | 98 // inlineStyle: focused ? _focusedInlineStyle : null, |
| 92 children: children | 99 children: children |
| 93 ), | 100 ), |
| 94 onPointerDown: (sky.Event e) => keyboard.showByRequest() | 101 onPointerDown: (sky.Event e) => keyboard.showByRequest() |
| 95 ); | 102 ); |
| 96 } | 103 } |
| 97 | 104 |
| 98 } | 105 } |
| OLD | NEW |