PageTransition<T> constructor
PageTransition<T> ({
- Key? key,
- Widget? child,
- ChildBuilder? childBuilder,
- required PageTransitionType type,
- Widget? childCurrent,
- BuildContext? ctx,
- bool inheritTheme = false,
- Curve curve = Curves.linear,
- Alignment? alignment,
- Duration? duration,
- Duration? reverseDuration,
- bool fullscreenDialog = false,
- bool opaque = false,
- PageTransitionsBuilder matchingBuilder = const CupertinoPageTransitionsBuilder(),
- bool? maintainStateData,
- 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:
alignment
is required for PageTransitionType.scale, PageTransitionType.rotate, and PageTransitionType.sizechildCurrent
is required for joined and pop transition types (e.g., PageTransitionType.rightToLeftJoined)ctx
is required wheninheritTheme
is true
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;
}