我有一个警报对话框,我想在其外部单击时将其关闭,我知道这是抖动对话框中默认的行为,但是我不知道是什么问题阻止了其在外部单击时关闭。
我尝试将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);
在onPressed或onTap上调用此方法: