Я хочу растянуть диалоговое окно в сторону, но я не нашел, как это сделать (этот AlertDialog был реорганизован). Я пытался использовать ConstrainedBox , но, похоже, он не работал, если я не реализовал его правильно.
Вот мой код
class CustomAlertDialog {
CustomAlertDialog(
{@required this.context,
@required this.title,
@required this.description});
final BuildContext context;
final String title;
final String description;
Function showDialogVar;
Future show() async {
return showDialogVar = await showDialog(
context: context,
builder: (BuildContext context) => AlertDialog(
contentPadding: EdgeInsets.fromLTRB(25, 15, 0, 0),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(24))),
title: Text(title,
style: TextStyle(
fontFamily: 'Nunito',
color: Colors.black,
fontWeight: FontWeight.w700)),
content: Text(description,
style: TextStyle(
fontFamily: 'NotoSans',
color: kErrorRed,
)),
actions: <Widget>[
FlatButton(
onPressed: () {
Navigator.of(context).pop();
},
child: Text('OK',
style: TextStyle(
fontFamily: 'Nunito',
fontWeight: FontWeight.w800,
color: Colors.black)),
),
],
elevation: 10.0,
),
);
}
}
и вот как я это использую
CustomAlertDialog(
context: context,
title: 'Missed Something .-.',
description: 'You did not select your \nGender.').show();