@@ -547,34 +547,34 @@ class SlidableDrawerDelegate extends SlidableStackDelegate {
547
547
Widget buildStackActions(BuildContext context, SlidableDelegateContext ctx) {
548
548
return new Positioned.fill(
549
549
child: new LayoutBuilder(builder: (context, constraints) {
550
- final count = ctx.state.actionCount;
550
+ final state = ctx.state;
551
+ final count = state.actionCount;
552
+ final bool showActions = ctx.showActions;
553
+ final Animation<double> actionsMoveAnimation =
554
+ state.actionsMoveAnimation;
551
555
final double actionExtent =
552
- ctx.getMaxExtent(constraints) * ctx.state.widget.actionExtentRatio;
556
+ ctx.getMaxExtent(constraints) * state.widget.actionExtentRatio;
557
+ final SlideActionDelegate actionDelegate = state.actionDelegate;
553
558
554
559
final animations = Iterable.generate(count).map((index) {
555
560
return new Tween(
556
561
begin: ctx.createOffset(-actionExtent),
557
562
end: ctx.createOffset((count - index - 1) * actionExtent),
558
- ).animate(ctx.state. actionsMoveAnimation);
563
+ ).animate(actionsMoveAnimation);
559
564
}).toList();
560
565
561
566
return new AnimatedBuilder(
562
- animation: ctx.state. actionsMoveAnimation,
567
+ animation: actionsMoveAnimation,
563
568
builder: (context, child) {
564
569
return new Stack(
565
- children: List.generate(ctx.state.actionCount , (index) {
570
+ children: List.generate(count , (index) {
566
571
// For the main actions we have to reverse the order if we want the last item at the bottom of the stack.
567
- int displayIndex = ctx.showActions
568
- ? ctx.state.actionCount - index - 1
569
- : index;
572
+ int displayIndex = showActions ? count - index - 1 : index;
570
573
return ctx.createPositioned(
571
574
position: ctx.getAnimationValue(animations[index]),
572
575
extent: actionExtent,
573
- child: ctx.state.actionDelegate.build(
574
- context,
575
- displayIndex,
576
- ctx.state.actionsMoveAnimation,
577
- SlidableRenderingMode.slide),
576
+ child: actionDelegate.build(context, displayIndex,
577
+ actionsMoveAnimation, SlidableRenderingMode.slide),
578
578
);
579
579
}),
580
580
);
0 commit comments