| 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 '../layout.dart'; |
| 9 import '../theme/colors.dart'; | 10 import '../theme/colors.dart'; |
| 10 import '../theme/typography.dart' as typography; | 11 import '../theme/typography.dart' as typography; |
| 11 import 'dart:sky' as sky; | 12 import 'dart:sky' as sky; |
| 12 | 13 |
| 13 typedef void ValueChanged(value); | 14 typedef void ValueChanged(value); |
| 14 | 15 |
| 15 class Input extends Component { | 16 class Input extends Component { |
| 16 static final Style _style = new Style(''' | 17 static final Style _style = new Style(''' |
| 17 display: paragraph; | |
| 18 transform: translateX(0); | 18 transform: translateX(0); |
| 19 margin: 8px; | 19 margin: 8px; |
| 20 padding: 8px; | 20 padding: 8px; |
| 21 border-bottom: 1px solid ${Grey[200]}; | 21 border-bottom: 1px solid ${Grey[200]}; |
| 22 align-self: center; | 22 align-self: center; |
| 23 height: 1.2em; | 23 height: 1.2em; |
| 24 white-space: pre; | 24 white-space: pre; |
| 25 overflow: hidden;''' | 25 overflow: hidden;''' |
| 26 ); | 26 ); |
| 27 | 27 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 if (placeholder != null && _value.isEmpty) { | 77 if (placeholder != null && _value.isEmpty) { |
| 78 children.add(new Container( | 78 children.add(new Container( |
| 79 style: _placeholderStyle, | 79 style: _placeholderStyle, |
| 80 children: [new Text(placeholder)] | 80 children: [new Text(placeholder)] |
| 81 )); | 81 )); |
| 82 } | 82 } |
| 83 | 83 |
| 84 children.add(new EditableText(value: _editableValue, focused: focused)); | 84 children.add(new EditableText(value: _editableValue, focused: focused)); |
| 85 | 85 |
| 86 return new EventListenerNode( | 86 return new EventListenerNode( |
| 87 new Container( | 87 new FlexContainer( |
| 88 direction: FlexDirection.Column, |
| 88 style: _style, | 89 style: _style, |
| 89 inlineStyle: focused ? _focusedInlineStyle : null, | 90 inlineStyle: focused ? _focusedInlineStyle : null, |
| 90 children: children | 91 children: children |
| 91 ), | 92 ), |
| 92 onPointerDown: (sky.Event e) => keyboard.showByRequest() | 93 onPointerDown: (sky.Event e) => keyboard.showByRequest() |
| 93 ); | 94 ); |
| 94 } | 95 } |
| 95 } | 96 } |
| OLD | NEW |