OpenCustomSheet.openConfirmSheet constructor

OpenCustomSheet.openConfirmSheet(
  1. BuildContext context, {
  2. required Widget body,
  3. dynamic onClose(
    1. dynamic
    )?,
  4. Color? backgroundColor,
  5. Color? handleColor,
  6. bool barrierDismissible = true,
  7. Color? firstButtonColor,
  8. Color? secondButtonColor,
  9. Color? firstButtonTextColor,
  10. Color? secondButtonTextColor,
  11. String? confirmButtonText,
  12. String? cancelButtonText,
  13. EdgeInsetsGeometry? padding,
  14. 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,
  );
}