OpenCustomSheet.openConfirmSheet constructor
OpenCustomSheet.openConfirmSheet(
- BuildContext context, {
- required Widget body,
- dynamic onClose(
- dynamic
- Color? backgroundColor,
- Color? handleColor,
- bool barrierDismissible = true,
- Color? firstButtonColor,
- Color? secondButtonColor,
- Color? firstButtonTextColor,
- Color? secondButtonTextColor,
- String? confirmButtonText,
- String? cancelButtonText,
- EdgeInsetsGeometry? padding,
- double? buttonSpacing,
Factory constructor to create a confirmation sheet with default action buttons.
The confirmation sheet includes Confirm and Cancel buttons at the bottom.
Example usage:
OpenCustomSheet.openConfirmSheet(
context,
body: ({scrollController}) => Text('Are you sure you want to proceed?'),
onClose: (result) {
if (result == true) {
// Handle confirmation
} else {
// Handle cancellation
}
},
);
Implementation
factory OpenCustomSheet.openConfirmSheet(
BuildContext context, {
required Widget body,
Function(dynamic)? onClose,
Color? backgroundColor,
Color? handleColor,
bool barrierDismissible = true,
Color? firstButtonColor,
Color? secondButtonColor,
Color? firstButtonTextColor,
Color? secondButtonTextColor,
String? confirmButtonText,
String? cancelButtonText,
EdgeInsetsGeometry? padding,
double? buttonSpacing,
}) {
return OpenCustomSheet(
barrierDismissible: barrierDismissible,
barrierColor: Colors.black.withOpacity(0.5),
onClose: onClose,
backgroundColor: backgroundColor,
handleColor: handleColor,
padding: padding,
buttonSpacing: buttonSpacing,
firstButtonColor: firstButtonColor,
secondButtonColor: secondButtonColor,
firstButtonTextColor: firstButtonTextColor,
secondButtonTextColor: secondButtonTextColor,
confirmButtonText: confirmButtonText,
cancelButtonText: cancelButtonText,
showDefaultButtons: true,
// Enable default buttons for confirm sheet
body: ({scrollController}) => body,
);
}