Skip to main content

Confirm Dialog

CometChatConfirmDialog is a customizable alert dialog .

How to integrate CometChatConfirmDialog ?

Since CometChatConfirmDialog is a AlertDialog, it can be called by function showCometChatConfirmDialog . CometChatConfirmDialog includes various attributes to customize its UI.

Usage

showCometChatConfirmDialog(
context: context,
confirmButtonText: "yes",
cancelButtonText: "no",
messageText: "this is a message",
onCancel: () {
// Write on cancel function here
Navigator.pop(context);
},
style: ConfirmDialogStyle(
backgroundColor:Colors.lightBlue,
shadowColor: Colors.teal,
confirmButtonTextStyle:TextStyle(fontSize: 12, color: Colors.yellow),
cancelButtonTextStyle: TextStyle(fontSize: 12, color: Colors.pink)
onConfirm: () async {
// write on Confirm function here
Navigator.pop(context);
}
)
);

Properties

ParametersTypeDescription
contextBuildContextrequired to determine the location in the widget tree where the confirm dialog needs to be shown
titleWidgetused to set title on top of the confirm dialog
messageTextWidgetused to set the text for the message to display on the dialog
confirmButtonTextStringused to set the text on the confirm button
cancelButtonTextStringused to set the text on the cancel button
onConfirmFunction()required to set function to be called when clicked on confirm Button
onCancelFunction()required to set function to be called when clicked on cancel Button
styleConfirmDialogStyleused to customize the confirm dialog

ConfirmDialogStyle

style class to alter Confirm dialog styling properties.


Properties

ParametersTypeDescription
backgroundColorColorUsed to set background color
shadowColorColorUsed to set shadow color
confirmButtonTextStyleTextStyleUsed to set confirm button text style
cancelButtonTextStyleTextStyleUsed to set the cancel button text style