SlidingSheet constructor
- Key? key,
- SheetBuilder? builder,
- CustomSheetBuilder? customBuilder,
- SheetBuilder? headerBuilder,
- SnapSpec snapSpec = const SnapSpec(),
- Duration duration = const Duration(milliseconds: 1000),
- Color? color,
- Color? backdropColor,
- Color shadowColor = Colors.black54,
- double elevation = 0.0,
- EdgeInsets? padding,
- bool addTopViewPaddingOnFullscreen = false,
- EdgeInsets? margin,
- Border? border,
- double cornerRadius = 0.0,
- double? cornerRadiusOnFullscreen,
- bool closeOnBackdropTap = false,
- SheetListener? listener,
- SheetController? controller,
- ScrollSpec scrollSpec = const ScrollSpec(overscroll: false),
- double maxWidth = double.infinity,
- double? minHeight,
- bool closeOnBackButtonPressed = false,
- bool isBackdropInteractable = false,
- Widget? body,
- ParallaxSpec? parallaxSpec,
- double axisAlignment = 0.0,
- bool extendBody = false,
- double liftOnScrollHeaderElevation = 0.0,
Creates a sheet than can be dragged and scrolled in a single gesture to be placed inside you widget tree.
The builder
callback is used to build the main content of the sheet that
will be scrolled if the content is bigger than the height that the sheet can expand to.
The headerBuilder
and footerBuilder
can be used to build persistent widget on top
and bottom respectively, that wont be scrolled but will delegate the interactions on
them to the sheet.
The listener
callback is being invoked when the sheet gets dragged or scrolled
with current state information.
The snapSpec
can be used to customize the snapping behavior. There you can custom snap
extents, whether the sheet should snap at all, and how to position those snaps.
If addTopViewPaddingOnFullscreen
is set to true, the sheet will add the status bar height
as a top padding to it in order to avoid the status bar it it is translucent.
The cornerRadiusOnFullscreen
parameter can be used to easily implement the common Material
behaviour of sheets to go from rounded corners to sharp corners when
taking up the full screen.
The body
parameter can be used to place a widget behind the sheet and a parallax effect can
be applied to it using the parallaxSpec
parameter.
The axisAlignment
parameter can be used to align the sheet on the horizontal axis when the available
width is bigger than the maxWidth
of the sheet.
Implementation
SlidingSheet({
Key? key,
SheetBuilder? builder,
CustomSheetBuilder? customBuilder,
SheetBuilder? headerBuilder,
SheetBuilder? footerBuilder,
SnapSpec snapSpec = const SnapSpec(),
Duration duration = const Duration(milliseconds: 1000),
Color? color,
Color? backdropColor,
Color shadowColor = Colors.black54,
double elevation = 0.0,
EdgeInsets? padding,
bool addTopViewPaddingOnFullscreen = false,
EdgeInsets? margin,
Border? border,
double cornerRadius = 0.0,
double? cornerRadiusOnFullscreen,
bool closeOnBackdropTap = false,
SheetListener? listener,
SheetController? controller,
ScrollSpec scrollSpec = const ScrollSpec(overscroll: false),
double maxWidth = double.infinity,
double? minHeight,
bool closeOnBackButtonPressed = false,
bool isBackdropInteractable = false,
Widget? body,
ParallaxSpec? parallaxSpec,
double axisAlignment = 0.0,
bool extendBody = false,
double liftOnScrollHeaderElevation = 0.0,
double liftOnScrollFooterElevation = 0.0,
}) : this._(
key: key,
builder: builder,
customBuilder: customBuilder,
headerBuilder: headerBuilder,
footerBuilder: footerBuilder,
snapSpec: snapSpec,
duration: duration,
color: color,
backdropColor: backdropColor,
shadowColor: shadowColor,
elevation: elevation,
padding: padding,
avoidStatusBar: addTopViewPaddingOnFullscreen,
margin: margin,
border: border,
cornerRadius: cornerRadius,
cornerRadiusOnFullscreen: cornerRadiusOnFullscreen,
closeOnBackdropTap: closeOnBackdropTap,
listener: listener,
controller: controller,
scrollSpec: scrollSpec,
maxWidth: maxWidth,
minHeight: minHeight,
closeSheetOnBackButtonPressed: closeOnBackButtonPressed,
isBackdropInteractable: isBackdropInteractable,
body: body,
parallaxSpec: parallaxSpec,
axisAlignment: axisAlignment,
extendBody: extendBody,
liftOnScrollHeaderElevation: liftOnScrollHeaderElevation,
liftOnScrollFooterElevation: liftOnScrollFooterElevation,
);