createRenderObject method

  1. @override
RenderSlideAction createRenderObject(
  1. BuildContext context
)
override

although this RenderSlideAction has not been attached to RenderSlidable during createRenderObject, its Element has been mounted to the element tree. Therefore, we can use BuildContext.findAncestorRenderObjectOfType to get the RenderSlidable

Implementation

@override
RenderSlideAction createRenderObject(BuildContext context) {
  final slidableRender = of(context);

  final controller = position == ActionPosition.pre
      ? slidableRender.preActionController
      : slidableRender.postActionController;

  return RenderSlideAction(
    actionLayout: actionLayout,
    slidePercent: slidableRender.slidePercent,
    controller: controller,
  );
}