Migrate from Input to TextField

We expect TextField to be used much more often than Input. This patch updates
our old example code to use TextField instead.

See #7031
This commit is contained in:
Adam Barth
2017-01-19 13:03:54 -08:00
committed by Adam Barth
parent 930b52a3e5
commit b2a2ee72f9
4 changed files with 10 additions and 51 deletions

View File

@@ -290,8 +290,7 @@ class StockHomeState extends State<StockHome> {
onPressed: _handleSearchEnd,
tooltip: 'Back'
),
title: new Input(
value: _searchQuery,
title: new TextField(
autofocus: true,
hintText: 'Search stocks',
onChanged: _handleSearchQueryChanged
@@ -336,30 +335,15 @@ class StockHomeState extends State<StockHome> {
}
}
class _CreateCompanySheet extends StatefulWidget {
@override
_CreateCompanySheetState createState() => new _CreateCompanySheetState();
}
class _CreateCompanySheetState extends State<_CreateCompanySheet> {
InputValue _companyName = InputValue.empty;
void _handleCompanyNameChanged(InputValue value) {
setState(() {
_companyName = value;
});
}
class _CreateCompanySheet extends StatelessWidget {
@override
Widget build(BuildContext context) {
// TODO(ianh): Fill this out.
return new Column(
children: <Widget>[
new Input(
new TextField(
autofocus: true,
hintText: 'Company Name',
value: _companyName,
onChanged: _handleCompanyNameChanged
),
]
);