Swiper constructor

const Swiper({
  1. Key? key,
  2. bool enabled = true,
  3. required OverlayPosition position,
  4. required WidgetBuilder builder,
  5. required SwiperHandler handler,
  6. bool? expands,
  7. bool? draggable,
  8. bool? barrierDismissible,
  9. WidgetBuilder? backdropBuilder,
  10. bool? useSafeArea,
  11. bool? showDragHandle,
  12. BorderRadiusGeometry? borderRadius,
  13. Size? dragHandleSize,
  14. bool? transformBackdrop,
  15. double? surfaceOpacity,
  16. double? surfaceBlur,
  17. Color? barrierColor,
  18. HitTestBehavior? behavior,
  19. required Widget child,
})

Creates a Swiper.

The position, builder, handler, and child parameters are required. Other parameters customize the overlay behavior and appearance.

Parameters:

  • enabled (bool, default: true): whether swipe gestures are enabled
  • position (OverlayPosition, required): side from which overlay appears
  • builder (WidgetBuilder, required): builds the overlay content
  • handler (SwiperHandler, required): defines overlay behavior (drawer/sheet)
  • child (Widget, required): widget that responds to swipe gestures
  • expands (bool?, optional): whether overlay expands to fill space
  • draggable (bool?, optional): whether overlay can be dragged to dismiss
  • barrierDismissible (bool?, optional): whether barrier tap dismisses overlay
  • backdropBuilder (WidgetBuilder?, optional): custom backdrop builder
  • useSafeArea (bool?, optional): whether to respect safe areas
  • showDragHandle (bool?, optional): whether to show drag handle
  • borderRadius (BorderRadiusGeometry?, optional): overlay corner radius
  • dragHandleSize (Size?, optional): size of drag handle
  • transformBackdrop (bool?, optional): whether to transform backdrop
  • surfaceOpacity (double?, optional): surface opacity level
  • surfaceBlur (double?, optional): surface blur intensity
  • barrierColor (Color?, optional): modal barrier color
  • behavior (HitTestBehavior?, optional): gesture detection behavior

Example:

Swiper(
  position: OverlayPosition.bottom,
  handler: SwiperHandler.sheet,
  builder: (context) => ActionSheet(),
  child: FloatingActionButton(
    onPressed: null,
    child: Icon(Icons.more_horiz),
  ),
)

Implementation

const Swiper({
  super.key,
  this.enabled = true,
  required this.position,
  required this.builder,
  required this.handler,
  this.expands,
  this.draggable,
  this.barrierDismissible,
  this.backdropBuilder,
  this.useSafeArea,
  this.showDragHandle,
  this.borderRadius,
  this.dragHandleSize,
  this.transformBackdrop,
  this.surfaceOpacity,
  this.surfaceBlur,
  this.barrierColor,
  this.behavior,
  required this.child,
});