showAlert static method
AlertHandler
showAlert(
- AlertInfo info,
- BuildContext context, {
- Color? barrierColor,
- bool showContent = true,
Implementation
static AlertHandler showAlert(
AlertInfo info,
BuildContext context, {
Color? barrierColor,
bool showContent = true,
bool useRootNavigator = false,
}) {
final id = AtomicAlertDialog.showWithConfig(
context,
enableHide: true,
rootOverlay: useRootNavigator,
config: AlertDialogConfig(
title: '',
content: info.description,
itemList: info.itemList,
cancelConfig: info.cancelText?.isNotEmpty == true
? ButtonConfig(
text: info.cancelText!,
onClick: info.cancelCallback,
)
: null,
confirmConfig: info.defaultText?.isNotEmpty == true
? ButtonConfig(
text: info.defaultText!,
type: info.isDestructive ? TextColorPreset.red : TextColorPreset.blue,
onClick: info.defaultCallback,
)
: null,
),
);
AlertHandler alertHandler = AlertHandler(handID: id);
alertHandler.setContentVisible(showContent);
return alertHandler;
}