Swiper constructor
const
Swiper({
- Key? key,
- bool enabled = true,
- required OverlayPosition position,
- required WidgetBuilder builder,
- required SwiperHandler handler,
- bool? expands,
- bool? draggable,
- bool? barrierDismissible,
- WidgetBuilder? backdropBuilder,
- bool? useSafeArea,
- bool? showDragHandle,
- BorderRadiusGeometry? borderRadius,
- Size? dragHandleSize,
- bool? transformBackdrop,
- double? surfaceOpacity,
- double? surfaceBlur,
- Color? barrierColor,
- HitTestBehavior? behavior,
- 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 enabledposition(OverlayPosition, required): side from which overlay appearsbuilder(WidgetBuilder, required): builds the overlay contenthandler(SwiperHandler, required): defines overlay behavior (drawer/sheet)child(Widget, required): widget that responds to swipe gesturesexpands(bool?, optional): whether overlay expands to fill spacedraggable(bool?, optional): whether overlay can be dragged to dismissbarrierDismissible(bool?, optional): whether barrier tap dismisses overlaybackdropBuilder(WidgetBuilder?, optional): custom backdrop builderuseSafeArea(bool?, optional): whether to respect safe areasshowDragHandle(bool?, optional): whether to show drag handleborderRadius(BorderRadiusGeometry?, optional): overlay corner radiusdragHandleSize(Size?, optional): size of drag handletransformBackdrop(bool?, optional): whether to transform backdropsurfaceOpacity(double?, optional): surface opacity levelsurfaceBlur(double?, optional): surface blur intensitybarrierColor(Color?, optional): modal barrier colorbehavior(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,
});