platformPageRoute<T> function
PageRoute<T>
platformPageRoute<T>({
- required BuildContext context,
- WidgetBuilder? builder,
- RouteSettings? settings,
- bool? maintainState,
- bool? fullscreenDialog,
- String? iosTitle,
- bool allowSnapshotting = true,
- bool barrierDismissible = false,
- PlatformBuilder<
MaterialPageRouteData> ? material, - PlatformBuilder<
CupertinoPageRouteData> ? cupertino,
Implementation
PageRoute<T> platformPageRoute<T>({
required BuildContext context,
WidgetBuilder? builder,
RouteSettings? settings,
bool? maintainState,
bool? fullscreenDialog,
String? iosTitle,
bool allowSnapshotting = true,
bool barrierDismissible = false,
PlatformBuilder<MaterialPageRouteData>? material,
PlatformBuilder<CupertinoPageRouteData>? cupertino,
}) {
if (isMaterial(context)) {
final data = material?.call(context, platform(context));
return MaterialPageRoute<T>(
builder: data?.builder ?? builder!,
settings: data?.settings ?? settings,
maintainState: data?.maintainState ?? maintainState ?? true,
fullscreenDialog: data?.fullscreenDialog ?? fullscreenDialog ?? false,
allowSnapshotting: data?.allowSnapshotting ?? allowSnapshotting,
barrierDismissible: data?.barrierDismissible ?? barrierDismissible,
);
} else {
final data = cupertino?.call(context, platform(context));
return CupertinoPageRoute<T>(
builder: data?.builder ?? builder!,
settings: data?.settings ?? settings,
maintainState: data?.maintainState ?? maintainState ?? true,
fullscreenDialog: data?.fullscreenDialog ?? fullscreenDialog ?? false,
title: iosTitle,
allowSnapshotting: data?.allowSnapshotting ?? allowSnapshotting,
barrierDismissible: data?.barrierDismissible ?? barrierDismissible,
);
}
}