I have applied sweetalert
in my project my application is in landscape direction and sweetalert
take the full screen I want to set custom width and height to 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;
}
});
Solution 1: Amit Prajapati
Okay, wrap your string with three quote (''' String '''), Add space or new lines what you want base on your expected height.
https://api.dartlang.org/stable/2.5.0/dart-core/String-class.html
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;
}
},
);
Solution 2: DmDev
There is no any option according to my assessment for your question. but I think rflutter_alert
is the best option to use instead of sweetalert
here you can use the width and height to customize it. Hope that will help you. you can add multiple buttons in buttons: [],
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();