protected override Widget buildStackActions(BuildContext context, CustomDismissibleDelegateContext ctx) { return(Positioned.fill( new LayoutBuilder(builder: (_context, constraints) => { var totalExtent = ctx.getMaxExtent(constraints) * ctx.state.totalActionsExtent; var animation = new FloatTween(-totalExtent, 0).animate(ctx.state.actionsMoveAnimation); return new AnimatedBuilder( animation: ctx.state.actionsMoveAnimation, builder: (cxt, child) => { var widgets = new List <Widget>(); ctx.buildActions(cxt).ForEach(item => { var widget = new Expanded(child: item); widgets.Add(widget); }); return new Stack( children: new List <Widget> { ctx.createPositioned( position: animation.value, extent: totalExtent, child: new Flex( ctx.state.widget.direction, children: widgets ) ) } ); } ); }) )); }
protected override Widget buildStackActions(BuildContext context, CustomDismissibleDelegateContext ctx) { return(Positioned.fill( new LayoutBuilder(builder: (_context, constraints) => { var widgets = new List <Widget>(); ctx.buildActions(_context).ForEach(item => { var widget = new Expanded(child: item); widgets.Add(widget); }); return new Stack( children: new List <Widget> { ctx.createPositioned( position: 0, extent: ctx.getMaxExtent(constraints) * ctx.state.totalActionsExtent, child: new Flex( ctx.state.widget.direction, children: widgets ) ) } ); }) )); }
protected override Widget buildStackActions(BuildContext context, CustomDismissibleDelegateContext ctx) { return(Positioned.fill( new LayoutBuilder(builder: (_context, constraints) => { var state = ctx.state; var count = state.actionCount; var showActions = ctx.showActions; var actionsMoveAnimation = state.actionsMoveAnimation; var actionExtent = ctx.getMaxExtent(constraints) * state.widget.actionExtentRatio; var actionDelegate = state.actionDelegate; var animations = new List <Animation <float> >(); for (var index = 0; index < count; index++) { var animation = new FloatTween( -(float)actionExtent, (count - index - 1) * (float)actionExtent ).animate(actionsMoveAnimation); animations.Add(animation); } return new AnimatedBuilder( animation: actionsMoveAnimation, builder: (cxt, child) => { var widgets = new List <Widget>(); for (var index = 0; index < count; index++) { var displayIndex = showActions ? count - index - 1 : index; var widget = ctx.createPositioned( position: animations[index].value, extent: (float)actionExtent, child: actionDelegate.build( context, displayIndex, actionsMoveAnimation, CustomDismissibleMode.slide ) ); widgets.Add(widget); } return new Stack( children: widgets ); } ); }) )); }
protected override Widget buildActionsWhileDismissing(BuildContext context, CustomDismissibleDelegateContext ctx) { var animation = new OffsetTween( Offset.zero, ctx.createOffset(ctx.state.dragSign) ).animate(ctx.state.overallMoveAnimation); return(new Container( child: new Stack( children: new List <Widget> { Positioned.fill( new LayoutBuilder(builder: (_context, constraints) => { var count = ctx.state.actionCount; var actionExtent = ctx.getMaxExtent(constraints) * ctx.state.widget.actionExtentRatio; var totalExtent = ctx.getMaxExtent(constraints); var extentAnimations = new List <Animation <float> >(); for (var index = 0; index < count; index++) { var extentAnimation = new FloatTween( (float)actionExtent, totalExtent - (float)actionExtent * (ctx.state.actionCount - index - 1) ).animate( new CurvedAnimation( ctx.state.overallMoveAnimation, new Interval(ctx.state.totalActionsExtent, 1) ) ); extentAnimations.Add(extentAnimation); } return new AnimatedBuilder( animation: ctx.state.overallMoveAnimation, builder: (cxt, child) => { var widgets = new List <Widget>(); for (var index = 0; index < ctx.state.actionCount; index++) { var displayIndex = ctx.showActions ? ctx.state.actionCount - index - 1 : index; var widget = ctx.createPositioned( position: (float)actionExtent * (ctx.state.actionCount - index - 1), extent: extentAnimations[index].value, child: ctx.state.actionDelegate.build( context, displayIndex, ctx.state.overallMoveAnimation, ctx.state.renderingMode ) ); widgets.Add(widget); } return new Stack( children: widgets ); } ); } ) ), new SlideTransition( position: animation, child: ctx.state.widget.child ) } ))); }