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:
@@ -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
|
||||
),
|
||||
]
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user