OpenCustomSheet class

A class responsible for displaying customized modal bottom sheets.

The OpenCustomSheet class provides a flexible and reusable way to present modal bottom sheets with various customization options, such as padding, colors, shapes, and default action buttons. It supports both scrollable and non-scrollable sheets, and includes factory constructors for common sheet configurations like confirmation dialogs and scrollable content areas.

Constructors

OpenCustomSheet({bool barrierDismissible = true, Color? barrierColor, String? barrierLabel, dynamic onClose(dynamic)?, required Widget body({ScrollController? scrollController}), bool scrollable = false, bool expand = true, double initialChildSize = 0.5, double minChildSize = 0.25, double maxChildSize = 1.0, Color? backgroundColor, Color? handleColor, ShapeBorder? sheetShape, EdgeInsetsGeometry? sheetPadding, Color? firstButtonColor, Color? secondButtonColor, Color? firstButtonTextColor, Color? secondButtonTextColor, String? confirmButtonText, String? cancelButtonText, EdgeInsetsGeometry? padding, double? buttonSpacing, bool showDefaultButtons = false})
Creates an instance of OpenCustomSheet with the specified properties.
const
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.
factory
OpenCustomSheet.scrollableSheet(BuildContext context, {required Widget body({ScrollController? scrollController}), dynamic onClose(dynamic)?, bool expand = true, double initialChildSize = 0.5, double minChildSize = 0.25, double maxChildSize = 1.0, Color? barrierColor, Color? backgroundColor, Color? handleColor, bool barrierDismissible = true, ShapeBorder? sheetShape, EdgeInsetsGeometry? sheetPadding})
Factory constructor to create a scrollable sheet without default action buttons.
factory

Properties

backgroundColor Color?
The background color of the sheet.
final
barrierColor Color?
The color of the modal barrier that darkens everything below the sheet.
final
barrierDismissible bool
Determines whether the sheet can be dismissed by tapping outside of it.
final
barrierLabel String?
The semantic label for the barrier.
final
body Widget Function({ScrollController? scrollController})
The main content of the sheet.
final
buttonSpacing double?
The spacing between the action buttons.
final
cancelButtonText String?
The text label for the cancellation button.
final
confirmButtonText String?
The text label for the confirmation button.
final
expand bool
Whether the sheet should expand to fill the available space.
final
firstButtonColor Color?
The background color of the first action button.
final
firstButtonTextColor Color?
The text color of the first action button.
final
handleColor Color?
The color of the handle (the small bar at the top of the sheet) used for dragging.
final
hashCode int
The hash code for this object.
no setterinherited
initialChildSize double
The initial size of the sheet as a fraction of the screen height.
final
maxChildSize double
The maximum size the sheet can be dragged up to, as a fraction of the screen height.
final
minChildSize double
The minimum size the sheet can be dragged down to, as a fraction of the screen height.
final
onClose → dynamic Function(dynamic)?
Callback invoked when the sheet is closed.
final
padding EdgeInsetsGeometry?
The padding around the action buttons.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scrollable bool
Determines if the sheet is scrollable.
final
secondButtonColor Color?
The background color of the second action button.
final
secondButtonTextColor Color?
The text color of the second action button.
final
sheetPadding EdgeInsetsGeometry?
The padding inside the sheet.
final
sheetShape ShapeBorder?
The shape of the sheet's border.
final
showDefaultButtons bool
Determines whether to show default action buttons (Confirm and Cancel).
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
show(BuildContext context) → void
Displays the custom sheet using showModalBottomSheet.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited