Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(899)

Unified Diff: sky/framework/components/input.dart

Issue 1002453003: Make Stocks app search actually search (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/examples/stocks-fn/stocksapp.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)]
« no previous file with comments | « sky/examples/stocks-fn/stocksapp.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698