SlidingSheet constructor

SlidingSheet({
  1. Key? key,
  2. SheetBuilder? builder,
  3. CustomSheetBuilder? customBuilder,
  4. SheetBuilder? headerBuilder,
  5. SheetBuilder? footerBuilder,
  6. SnapSpec snapSpec = const SnapSpec(),
  7. Duration duration = const Duration(milliseconds: 1000),
  8. Color? color,
  9. Color? backdropColor,
  10. Color shadowColor = Colors.black54,
  11. double elevation = 0.0,
  12. EdgeInsets? padding,
  13. bool addTopViewPaddingOnFullscreen = false,
  14. EdgeInsets? margin,
  15. Border? border,
  16. double cornerRadius = 0.0,
  17. double? cornerRadiusOnFullscreen,
  18. bool closeOnBackdropTap = false,
  19. SheetListener? listener,
  20. SheetController? controller,
  21. ScrollSpec scrollSpec = const ScrollSpec(overscroll: false),
  22. double maxWidth = double.infinity,
  23. double? minHeight,
  24. bool closeOnBackButtonPressed = false,
  25. bool isBackdropInteractable = false,
  26. Widget? body,
  27. ParallaxSpec? parallaxSpec,
  28. double axisAlignment = 0.0,
  29. bool extendBody = false,
  30. double liftOnScrollHeaderElevation = 0.0,
  31. double liftOnScrollFooterElevation = 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,
      );