| 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 import '../theme/typography.dart' as typography; |
| 10 | 11 |
| 11 typedef void ValueChanged(value); | 12 typedef void ValueChanged(value); |
| 12 | 13 |
| 13 class Input extends Component { | 14 class Input extends Component { |
| 14 static final Style _style = new Style(''' | 15 static final Style _style = new Style(''' |
| 15 display: paragraph; | 16 display: paragraph; |
| 16 transform: translateX(0); | 17 transform: translateX(0); |
| 17 margin: 8px; | 18 margin: 8px; |
| 18 padding: 8px; | 19 padding: 8px; |
| 19 border-bottom: 1px solid ${Grey[200]}; | 20 border-bottom: 1px solid ${Grey[200]}; |
| 20 align-self: center; | 21 align-self: center; |
| 21 height: 1.2em; | 22 height: 1.2em; |
| 22 white-space: pre; | 23 white-space: pre; |
| 23 overflow: hidden;''' | 24 overflow: hidden;''' |
| 24 ); | 25 ); |
| 25 | 26 |
| 26 static final Style _placeholderStyle = new Style(''' | 27 static final Style _placeholderStyle = new Style(''' |
| 27 top: 8px; | 28 top: 8px; |
| 28 left: 8px; | 29 left: 8px; |
| 29 color: ${Grey[200]}; | 30 position: absolute; |
| 30 position: absolute;''' | 31 ${typography.black.caption};''' |
| 31 ); | 32 ); |
| 32 | 33 |
| 33 static final String _focusedInlineStyle = ''' | 34 static final String _focusedInlineStyle = ''' |
| 34 padding: 7px; | 35 padding: 7px; |
| 35 border-bottom: 2px solid ${Blue[500]};'''; | 36 border-bottom: 2px solid ${Blue[500]};'''; |
| 36 | 37 |
| 37 ValueChanged onChanged; | 38 ValueChanged onChanged; |
| 38 String placeholder; | 39 String placeholder; |
| 39 bool focused = false; | 40 bool focused = false; |
| 40 | 41 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 | 82 |
| 82 children.add(new EditableText(value: _editableValue, focused: focused)); | 83 children.add(new EditableText(value: _editableValue, focused: focused)); |
| 83 | 84 |
| 84 return new Container( | 85 return new Container( |
| 85 style: _style, | 86 style: _style, |
| 86 inlineStyle: focused ? _focusedInlineStyle : null, | 87 inlineStyle: focused ? _focusedInlineStyle : null, |
| 87 children: children | 88 children: children |
| 88 ); | 89 ); |
| 89 } | 90 } |
| 90 } | 91 } |
| OLD | NEW |