Reputation: 975
Container( padding: EdgeInsets.all(15),
child: Column(
children: [
TextFormField(
onTap: () =>
Navigator.of(context).pushNamed(AirportSearchScreen.id).then(
(value)
{
setState(() {
_initValues['departureCity'] = value;
print(_initValues['departureCity']);
});
},
),
decoration: InputDecoration(
labelText: 'Departure City',
),
initialValue: _initValues['departureCity'],
),
],
),
);
When I am printing the value, it is give right result. But I am not able to get the result on TextFormField.
Upvotes: 0
Views: 133
Reputation: 1268
Try the code below :
child: Column(
children: [
TextFormField(
onTap: () =>
Navigator.of(context).pushNamed(AirportSearchScreen.id).then(
(value)
{
setState(() {
_initValues['departureCity'] = value;
print(_initValues['departureCity']);
});
},
),
decoration: InputDecoration(
labelText: 'Departure City',
),
controller: TextEditingController(text: _initValues['departureCity']),
),
],
),
Upvotes: 1