PageTransition<T> constructor

PageTransition<T>({
  1. Key? key,
  2. Widget? child,
  3. ChildBuilder? childBuilder,
  4. required PageTransitionType type,
  5. Widget? childCurrent,
  6. BuildContext? ctx,
  7. bool inheritTheme = false,
  8. Curve curve = Curves.linear,
  9. Alignment? alignment,
  10. Duration? duration,
  11. Duration? reverseDuration,
  12. bool fullscreenDialog = false,
  13. bool opaque = false,
  14. PageTransitionsBuilder matchingBuilder = const CupertinoPageTransitionsBuilder(),
  15. bool? maintainStateData,
  16. RouteSettings? settings,
})

Creates a PageTransition with the specified configuration.

Either child or childBuilder must be provided, but not both. When using certain transition types, additional parameters are required:

Implementation

PageTransition({
  Key? key,
  this.child,
  this.childBuilder,
  required this.type,
  this.childCurrent,
  this.ctx,
  this.inheritTheme = false,
  this.curve = Curves.linear,
  this.alignment,
  this.duration,
  this.reverseDuration,
  this.fullscreenDialog = false,
  this.opaque = false,
  this.matchingBuilder = const CupertinoPageTransitionsBuilder(),
  this.maintainStateData,
  super.settings,
})  : assert(child != null || childBuilder != null,
          'Either child or childBuilder must be provided'),
      assert(!(child != null && childBuilder != null),
          'Cannot provide both child and childBuilder'),
      assert(inheritTheme ? ctx != null : true,
          "'ctx' cannot be null when 'inheritTheme' is true, set ctx: context"),
      super(
        pageBuilder: (context, animation, secondaryAnimation) {
          return childBuilder?.call(context) ?? child!;
        },
        maintainState: maintainStateData ?? true,
        opaque: opaque,
        fullscreenDialog: fullscreenDialog,
      ) {
  this.reverseDuration = reverseDuration ?? duration;
  if (kIsWeb) {
    isIos = false;
    return;
  }
  isIos = Platform.isIOS;
}