Merge pull request #1747 from jason-simmons/input_field_clear

Change the text/selection value API of the input field
This commit is contained in:
Jason Simmons
2016-02-11 13:46:13 -08:00
9 changed files with 295 additions and 231 deletions

View File

@@ -7,12 +7,12 @@ import 'package:flutter/rendering.dart' show debugDumpRenderTree;
class CardModel {
CardModel(this.value, this.height) {
label = "Item $value";
inputValue = new InputValue(text: "Item $value");
}
int value;
double height;
int get color => ((value % 9) + 1) * 100;
String label;
InputValue inputValue;
Key get key => new ObjectKey(this);
}
@@ -305,9 +305,11 @@ class CardCollectionState extends State<CardCollection> {
new Center(
child: new Input(
key: new GlobalObjectKey(cardModel),
initialValue: cardModel.label,
onChanged: (String value) {
cardModel.label = value;
value: cardModel.inputValue,
onChanged: (InputValue value) {
setState(() {
cardModel.inputValue = value;
});
}
)
)
@@ -317,7 +319,7 @@ class CardCollectionState extends State<CardCollection> {
),
child: new Column(
children: <Widget>[
new Text(cardModel.label)
new Text(cardModel.inputValue.text)
],
alignItems: FlexAlignItems.stretch,
justifyContent: FlexJustifyContent.center