예제 #1
0
 public static CustomDismissible builder(
     Key key,
     Widget child,
     CustomDismissibleDelegate dismissibleDelegate,
     List <Widget> actions          = null,
     List <Widget> secondaryActions = null,
     float showAllActionsThreshold  = 0.5f,
     float?actionExtentRatio        = null,
     TimeSpan?movementDuration      = null,
     Axis direction     = Axis.horizontal,
     bool closeOnScroll = true,
     bool enabled       = true,
     SlideToDismissDelegate slideToDismissDelegate = null,
     CustomDismissibleController controller        = null
     )
 {
     return(new CustomDismissible(
                key,
                child,
                dismissibleDelegate,
                new SlideActionListDelegate(actions),
                new SlideActionListDelegate(secondaryActions),
                showAllActionsThreshold,
                actionExtentRatio ?? CustomDismissibleUtil.ActionsExtentRatio,
                movementDuration,
                direction,
                closeOnScroll,
                enabled,
                slideToDismissDelegate,
                controller
                ));
 }
예제 #2
0
 CustomDismissible(
     Key key,
     Widget child,
     CustomDismissibleDelegate dismissibleDelegate,
     SlideActionDelegate actionDelegate          = null,
     SlideActionDelegate secondaryActionDelegate = null,
     float showAllActionsThreshold = 0.5f,
     float?actionExtentRatio       = null,
     TimeSpan?movementDuration     = null,
     Axis direction     = Axis.horizontal,
     bool closeOnScroll = true,
     bool enabled       = true,
     SlideToDismissDelegate slideToDismissDelegate = null,
     CustomDismissibleController controller        = null
     ) : base(key)
 {
     D.assert(dismissibleDelegate != null);
     this.child = child;
     this.dismissibleDelegate     = dismissibleDelegate;
     this.actionDelegate          = actionDelegate;
     this.secondaryActionDelegate = secondaryActionDelegate;
     this.showAllActionsThreshold = showAllActionsThreshold;
     this.actionExtentRatio       = actionExtentRatio ?? CustomDismissibleUtil.ActionsExtentRatio;
     this.movementDuration        = movementDuration ?? CustomDismissibleUtil.MovementDuration;
     this.direction              = direction;
     this.closeOnScroll          = closeOnScroll;
     this.enabled                = enabled;
     this.slideToDismissDelegate = slideToDismissDelegate;
     this.controller             = controller;
 }
예제 #3
0
        public Widget buildActions(BuildContext context, CustomDismissibleDelegateContext ctx,
                                   CustomDismissibleDelegate dismissibleDelegate)
        {
            if (ctx.state.overallMoveAnimation.value > ctx.state.totalActionsExtent)
            {
                return(this.buildActionsWhileDismissing(context, ctx));
            }

            return(dismissibleDelegate.buildActions(context, ctx));
        }