Flutter showDialog在颤振中关于在其内部调用的方法有错误?
我使用的是showDialog方法,该对话框被称为showDialog,它将出现在地图上。showDialog在proDialog上有一些带有语句的红线 这是我正在使用的对话框小部件:Flutter showDialog在颤振中关于在其内部调用的方法有错误?,flutter,dart,Flutter,Dart,我使用的是showDialog方法,该对话框被称为showDialog,它将出现在地图上。showDialog在proDialog上有一些带有语句的红线 这是我正在使用的对话框小部件: WidgetBuilder proDialog = (BuildContext context) => Dialog( backgroundColor: Colors.white, child: Padding( padding: EdgeInsets.all(17.0), ch
WidgetBuilder proDialog = (BuildContext context) => Dialog(
backgroundColor: Colors.white,
child: Padding(
padding: EdgeInsets.all(17.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Padding(
padding: EdgeInsets.all(15.0),
child: Text(
'Your Profile',
style: TextStyle(
color: Colors.blue,
fontSize: 26.0,
),
),
),
Container(color: Colors.black, height: 2),
Row(mainAxisAlignment: MainAxisAlignment.start, children: <Widget>[
Padding(
padding: EdgeInsets.all(15.0),
child: Text(
'Take a Photo',
style: TextStyle(
fontSize: 26.0,
color: Colors.black,
),
),
),
]),
Container(color: Colors.black, height: 2),
SizedBox(height: 8),
RaisedButton(
padding: EdgeInsets.symmetric(horizontal: 40.0, vertical: 15.0),
textColor: Colors.white,
color: Colors.redAccent[800],
child: Text('Back', style: TextStyle(fontSize: 16)),
shape:
RoundedRectangleBorder(borderRadius: BorderRadius.circular(30.0)),
onPressed: () {
Navigator.pop(context);
},
)
],
),
),
);
这就是我打电话的地方,在proDialog上出现了一些错误
改变
Widget proDialog = (BuildContext context) => Dialog(
到
您应将对话框作为生成器传递或调用生成器:
showDialog(
context: context,
builder: proDialog,
);
或
否这是一个错误,说明无法将Dialog类型的值分配给WidgetBuilderbuild context->Widget.类型的变量。已更改为Widget
showDialog(
context: context,
builder: proDialog,
);
showDialog(
context: context,
builder: (BuildContext context) => proDialog(context),
);