我有一个警报对话框,我想在外部单击时将其关闭,我知道这是颤动中警报对话框的默认行为,但我不知道在外部单击时阻止它关闭的问题是什么。
我尝试将 barrierDismissable 设置为 true,但它仍然不起作用。
This is my dialog :
termsAndConditionsDialog(BuildContext context) {
AlertDialog alert = AlertDialog(
title: Text("Terms and Conditions", style: TextStyle(fontSize: 18, color: AppColors.accentColor),),
content: Text(
generalSettings.policyForCustomer,
style: TextStyle(fontSize: 16),
),
);
// show the dialog
showDialog(
barrierDismissible: true,
context: context,
builder: (BuildContext context) {
return alert;
},
);
}
and this is how I call it from button's onPressed :
termsAndConditionsDialog(context);