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 = const Duration(milliseconds: 200),
- Duration? reverseDuration = const Duration(milliseconds: 200),
- bool fullscreenDialog = false,
- bool opaque = false,
- bool isIos = false,
- PageTransitionsBuilder matchingBuilder = const CupertinoPageTransitionsBuilder(),
- bool? maintainStateData,
- PageTransitionType? reverseType,
- RouteSettings? settings,
Page transition constructor. We can pass the next page either as a child widget or as a builder function.
Example using child:
PageTransition(
type: PageTransitionType.rightToLeft,
child: DetailPage(),
)
Example using builder:
PageTransition(
type: PageTransitionType.rightToLeft,
builder: (context) => DetailPage(),
)
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 = const Duration(milliseconds: 200),
this.reverseDuration = const Duration(milliseconds: 200),
this.fullscreenDialog = false,
this.opaque = false,
this.isIos = false,
this.matchingBuilder = const CupertinoPageTransitionsBuilder(),
this.maintainStateData,
this.reverseType,
RouteSettings? 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!;
},
settings: settings,
maintainState: maintainStateData ?? true,
opaque: opaque,
fullscreenDialog: fullscreenDialog,
);