我正在使用showDialog
方法,该对话框在showDialog
内部调用(将显示onTap
)。showDialog
在带有某些语句的proDialog
上有红色快速线
这是我正在使用的Dialog
小部件:
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
最佳答案
应将对话框作为生成器传递或调用生成器:
showDialog(
context: context,
builder: proDialog,
);
或
showDialog(
context: context,
builder: (BuildContext context) => proDialog(context),
);
关于flutter - showDialog在flutter里面调用的方法有错误吗?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/56853595/