我有一个简单的对话框窗口小部件,它在Beta通道上的Windows上没有错误的情况下也能正常工作,但是当我在MacBook上拉同一个存储库时,会出现错误。两种环境都在Beta频道上
未定义命名参数“ child”。尝试将名称更正为现有命名参数的名称,或定义名称为'child'的命名参数
我的对话。是什么导致孩子抱怨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;
})
],
),
);
}
child
不推荐使用。您应该builder
改用。在showDialog的文档中已提及。
void _showDialog(BuildContext context, QRViewController controller, String result) async {
await showDialog(
context: context,
builder: (context) {
return AlertDialog();
},
);
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句