Reputation: 25
I have a simple dialog widget, it works fine with no errors on windows on beta channel, but when I pull the same repo on a MacBook I end with an error. Both environments are on beta channel
The named parameter 'child' isn't defined. Try correcting the name to an existing named parameter's name, or defining a named parameter with the name 'child'
my dialog. what could be causing the child to complain child: new AlertDialog(
?
void _showDialog(
BuildContext context, QRViewController controller, String result) async {
await showDialog<String>(
context: context,
// FIXME: child isn't defined for this function. need to use right params
child: new AlertDialog(
contentPadding: const EdgeInsets.all(16.0),
content: Container(
height: 400,
child: Column(
children: [
new Row(
children: [
Text(
'Please record your body temperature \nin Celsius from the digital reading \non the infrared thermometer',
),
],
),
new Row(
children: <Widget>[
new Expanded(
child: new TextField(
autofocus: true,
onChanged: (value) {
temp = value;
},
decoration: new InputDecoration(hintText: 'C'),
keyboardType: TextInputType.number,
inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.allow(
RegExp(r'^\d+\.?\d*')),
],
),
)
],
),
Row(
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Image.asset("assets/images/temp_checkin.jpg",
height: 250, fit: BoxFit.scaleDown),
),
],
)
],
),
),
actions: <Widget>[
new FlatButton(
child: const Text('CANCEL'),
onPressed: () {
_QRViewExampleState.capturedQRCode = false;
Navigator.pop(context);
}),
new FlatButton(
child: const Text('SUBMIT'),
onPressed: () {
Navigator.pop(context);
if (temp != '' && temp != null) {
_temperatureCheckIn(result, temp, context);
}
_QRViewExampleState.capturedQRCode = false;
})
],
),
);
}
Upvotes: 2
Views: 6318
Reputation: 5736
child
is deprecated. You should use builder
instead. It is mentioned in the Docs for showDialog.
void _showDialog(BuildContext context, QRViewController controller, String result) async {
await showDialog(
context: context,
builder: (context) {
return AlertDialog();
},
);
}
Upvotes: 8