transition method

Widget transition(
  1. BuildContext context,
  2. Widget? prevScreenBodyCapture,
  3. Widget currentScreenBody
)

Override to define how to transition from prevScreenBodyCapture to currentScreenBody.

Example 1:

// Render the previous screen capture underneath the current screen.
@override
Widget transition(
  BuildContext context,
  Widget? prevScreenBodyCapture,
  Widget currentScreenBody,
) {
 return WStack(
   children: [
     if (prevScreenBodyCapture != null) prevScreenBodyCapture,
     currentScreenBody,
   ],
 );
}

Example 2:

// Fade from the previous screen capture into the current screen.
@override
Widget transition(
  BuildContext context,
  Widget? prevScreenBodyCapture,
  Widget currentScreenBody,
) {
  if (prevScreenBodyCapture != null) {
    return WAnimatedFade(
      layer1: prevScreenBodyCapture,
      layer2: currentScreenBody,
    );
  } else {
    return currentScreenBody;
  }
}

Implementation

Widget transition(
  BuildContext context,
  Widget? prevScreenBodyCapture,
  Widget currentScreenBody,
) {
  return WStack(
    children: [
      if (prevScreenBodyCapture != null) prevScreenBodyCapture,
      currentScreenBody,
    ],
  );
}