Index: sky/framework/components/input.dart |
diff --git a/sky/framework/components/input.dart b/sky/framework/components/input.dart |
index 5c5cc3ce521572856c6a27410060909b750b770a..f264b4a4d88589bfbbfc464c1dc1551f7b0e0c19 100644 |
--- a/sky/framework/components/input.dart |
+++ b/sky/framework/components/input.dart |
@@ -35,25 +35,28 @@ class Input extends Component { |
border-bottom: 2px solid ${Blue[500]};'''; |
ValueChanged onChanged; |
- String value; |
String placeholder; |
bool focused = false; |
+ String _value = ''; |
bool _isAttachedToKeyboard = false; |
EditableString _editableValue; |
- Input({Object key, this.value: '', this.placeholder, this.focused}) |
+ Input({Object key, |
+ this.placeholder, |
+ this.onChanged, |
+ this.focused}) |
: super(key: key, stateful: true) { |
- _editableValue = new EditableString(text: value, |
+ _editableValue = new EditableString(text: _value, |
onUpdated: _handleTextUpdated); |
} |
void _handleTextUpdated() { |
setState(() {}); |
- if (value != _editableValue.text) { |
- value = _editableValue.text; |
+ if (_value != _editableValue.text) { |
+ _value = _editableValue.text; |
if (onChanged != null) |
- onChanged(value); |
+ onChanged(_value); |
} |
} |
@@ -70,7 +73,7 @@ class Input extends Component { |
List<Node> children = []; |
- if (placeholder != null && value.isEmpty) { |
+ if (placeholder != null && _value.isEmpty) { |
children.add(new Container( |
style: _placeholderStyle, |
children: [new Text(placeholder)] |