Slidable constructor

Slidable({
  1. Key? key,
  2. required Widget child,
  3. required Widget actionPane,
  4. List<Widget>? actions,
  5. List<Widget>? secondaryActions,
  6. double showAllActionsThreshold = 0.5,
  7. double actionExtentRatio = _kActionsExtentRatio,
  8. Duration movementDuration = _kMovementDuration,
  9. Axis direction = Axis.horizontal,
  10. bool closeOnScroll = true,
  11. bool enabled = true,
  12. SlidableDismissal? dismissal,
  13. SlidableController? controller,
  14. double? fastThreshold,
})

Creates a widget that can be slid.

The actions contains the slide actions that appears when the child has been dragged down or to the right. The secondaryActions contains the slide actions that appears when the child has been dragged up or to the left.

The delegate and closeOnScroll arguments must not be null. The actionExtentRatio and showAllActionsThreshold arguments must be greater or equal than 0 and less or equal than 1.

The key argument must not be null if the slideToDismissDelegate is provided because Slidables are commonly used in lists and removed from the list when dismissed. Without keys, the default behavior is to sync widgets based on their index in the list, which means the item after the dismissed item would be synced with the state of the dismissed item. Using keys causes the widgets to sync according to their keys and avoids this pitfall.

Implementation

Slidable({
  Key? key,
  required Widget child,
  required Widget actionPane,
  List<Widget>? actions,
  List<Widget>? secondaryActions,
  double showAllActionsThreshold = 0.5,
  double actionExtentRatio = _kActionsExtentRatio,
  Duration movementDuration = _kMovementDuration,
  Axis direction = Axis.horizontal,
  bool closeOnScroll = true,
  bool enabled = true,
  SlidableDismissal? dismissal,
  SlidableController? controller,
  double? fastThreshold,
}) : this.builder(
        key: key,
        child: child,
        actionPane: actionPane,
        actionDelegate: SlideActionListDelegate(actions: actions),
        secondaryActionDelegate:
            SlideActionListDelegate(actions: secondaryActions),
        showAllActionsThreshold: showAllActionsThreshold,
        actionExtentRatio: actionExtentRatio,
        movementDuration: movementDuration,
        direction: direction,
        closeOnScroll: closeOnScroll,
        enabled: enabled,
        dismissal: dismissal,
        controller: controller,
        fastThreshold: fastThreshold,
      );