replaceWithTransition<T> method

Future<T?>? replaceWithTransition<T>(
  1. Widget page, {
  2. bool? opaque,
  3. @Deprecated('Prefer to use the transitionStyle instead of using this property. This will be removed in the next major version update for stacked.') String transition = '',
  4. Duration? duration,
  5. bool? popGesture,
  6. int? id,
  7. Curve? curve,
  8. bool fullscreenDialog = false,
  9. bool preventDuplicates = true,
  10. @Deprecated('Prefer to use the transitionStyle instead of using this property. This will be removed in the next major version update for stacked.') Transition? transitionClass,
  11. Transition? transitionStyle,
  12. String? routeName,
})

Replaces current view in the navigation stack. This uses the page itself (Widget) instead of routeName (String).

id is for when you are using nested navigation, as explained in documentation.

If you want the same behavior of ios that pops a route when the user drag, you can set popGesture to true.

preventDuplicates will prevent you from pushing a route that you already in, if you want to push anyway, set to false.

duration transition duration.

opaque Whether the route obscures previous routes when the transition is complete.

routeName Name of the route to be pushed onto the navigation stack

Implementation

Future<T?>? replaceWithTransition<T>(
  Widget page, {
  bool? opaque,
  @Deprecated('Prefer to use the transitionStyle instead of using this property. This will be removed in the next major version update for stacked.')
      String transition = '',
  Duration? duration,
  bool? popGesture,
  int? id,
  Curve? curve,
  bool fullscreenDialog = false,
  bool preventDuplicates = true,
  @Deprecated('Prefer to use the transitionStyle instead of using this property. This will be removed in the next major version update for stacked.')
      Transition? transitionClass,
  Transition? transitionStyle,
  String? routeName,
}) {
  return G.Get.off<T?>(
    () => page,
    transition: transitionStyle?.toGet ??
        transitionClass?.toGet ??
        _getTransitionOrDefault(transition),
    duration: duration ?? G.Get.defaultTransitionDuration,
    popGesture: popGesture ?? G.Get.isPopGestureEnable,
    opaque: opaque ?? G.Get.isOpaqueRouteDefault,
    id: id,
    preventDuplicates: preventDuplicates,
    curve: curve,
    fullscreenDialog: fullscreenDialog,
    routeName: routeName,
  );
}