我在项目中应用了sweetalert
,我的应用程序是横向应用,而sweetalert
则全屏显示,我想将自定义宽度和高度设置为sweetalert
。
SweetAlert.show(context,
title: "Just show a message",
subtitle: "Sweet alert is pretty",
style: SweetAlertStyle.confirm,
showCancelButton: true, onPress: (bool isConfirm) {
if (isConfirm) {
SweetAlert.show(context,style: SweetAlertStyle.success,title: "Success");
// return false to keep dialog
return false;
}
});
最佳答案
根据我对您的问题的评估,没有任何选择。但是我认为rflutter_alert
是最好的选择,而不是sweetalert
在这里,您可以使用宽度和高度对其进行自定义。希望对您有所帮助。您可以在按钮中添加多个按钮:[],
import 'package:rflutter_alert/rflutter_alert.dart';
Alert(
context: context,
type: AlertType.error,
title: "RFLUTTER ALERT",
desc: "Flutter is more awesome with RFlutter Alert.",
buttons: [
DialogButton(
child: Text(
"COOL",
style: TextStyle(color: Colors.white, fontSize: 20),
),
onPressed: () => Navigator.pop(context),
width: 120,
)
],
).show();
关于flutter - 将自定义的高度和宽度设置为警报,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58134954/