Skip to content

Instantly share code, notes, and snippets.

@letsar
Last active August 24, 2018 13:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save letsar/b326a6e82c55eef09ca2a4bdf4bc5987 to your computer and use it in GitHub Desktop.
Save letsar/b326a6e82c55eef09ca2a4bdf4bc5987 to your computer and use it in GitHub Desktop.
slidable_in_depth_01
abstract class SlidableStackDelegate extends SlidableDelegate {
const SlidableStackDelegate({
double fastThreshold,
}) : super(fastThreshold: fastThreshold);
@override
Widget buildActions(BuildContext context, SlidableDelegateContext ctx) {
final animation = new Tween(
begin: Offset.zero,
end: ctx.createOffset(ctx.state.totalActionsExtent * ctx.state.dragSign),
).animate(ctx.state.actionsMoveAnimation);
if (ctx.state.actionsMoveAnimation.value != .0) {
return new Container(
child: new Stack(
children: <Widget>[
buildStackActions(
context,
ctx,
),
new SlideTransition(
position: animation,
child: ctx.state.widget.child,
),
],
),
);
} else {
return ctx.state.widget.child;
}
}
Widget buildStackActions(BuildContext context, SlidableDelegateContext ctx);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment