我想创建一个显示对话框更好的外观,如果有任何建议,我会尽我所能。
child: new InkWell(
onTap: (){
showDialog(
context : context,builder: (_) => AlertDialog(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(15.0))
),
elevation: 5.0,
title: Center(
child:Text
("Card 1",
style: TextStyle(color: Colors.indigo)
),
),
content: Text(" You have clicked on this card",
style: TextStyle(fontStyle: FontStyle.italic,fontWeight:FontWeight.bold),),
actions: <Widget>[
FlatButton(
child: Text("OK"),
onPressed: () {
Navigator.of(context).pop();
}
)
],
)
);
},
child:
Container(
width: 300,
height: 100,
child: Text('card 1',
style: TextStyle(
fontSize: 18.0,
color: Colors.white,
),
),
alignment: Alignment(0, 0),
),
),
),
我想使它的对话框看起来更好
答案 0 :(得分:0)
您可以使用CupertinoAlertDialog
此对话框类似于ios对话框。
它提供了默认的圆角矩形,因此您无需编写附加代码
onTap: () {
showDialog(
context: context,
builder: (_) => CupertinoAlertDialog(
title: Center(child: Text("Card 1", style: TextStyle(color: Colors.indigo)),),
content: Text(" You have clicked on this card", style: TextStyle(fontWeight: FontWeight.bold),),
actions: <Widget>[
FlatButton(
child: Text("OK"),
onPressed: () {
Navigator.of(context).pop();
})
],
));
},