【发布时间】:2021-05-13 13:01:14
【问题描述】:
我有一个简单的对话框小部件,它在 beta 通道的 windows 上运行良好,没有错误,但是当我在 MacBook 上提取相同的 repo 时,我以错误结束。两种环境都在测试版中
未定义命名参数“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;
})
],
),
);
}
【问题讨论】: