platformPage function
Page
platformPage({
- required BuildContext context,
- Widget? child,
- String? title,
- String? name,
- bool? maintainState,
- bool? fullscreenDialog,
- LocalKey? key,
- String? restorationId,
- Object? arguments,
- bool allowSnapshotting = true,
- PlatformBuilder<
MaterialPageData> ? material, - PlatformBuilder<
CupertinoPageData> ? cupertino,
Implementation
Page platformPage({
required BuildContext context,
Widget? child,
String? title,
String? name,
bool? maintainState,
bool? fullscreenDialog,
LocalKey? key,
String? restorationId,
Object? arguments,
bool allowSnapshotting = true,
PlatformBuilder<MaterialPageData>? material,
PlatformBuilder<CupertinoPageData>? cupertino,
}) {
if (isMaterial(context)) {
final data = material?.call(context, platform(context));
return MaterialPage(
key: data?.key ?? key,
child: data?.child ?? child!,
name: data?.name ?? name,
maintainState: data?.maintainState ?? maintainState ?? true,
arguments: data?.arguments ?? arguments,
fullscreenDialog: data?.fullscreenDialog ?? fullscreenDialog ?? false,
restorationId: data?.restorationId ?? restorationId,
allowSnapshotting: data?.allowSnapshotting ?? allowSnapshotting,
);
} else {
final data = cupertino?.call(context, platform(context));
return CupertinoPage(
key: data?.key ?? key,
child: data?.child ?? child!,
name: data?.name ?? name,
maintainState: data?.maintainState ?? maintainState ?? true,
arguments: data?.arguments ?? arguments,
fullscreenDialog: data?.fullscreenDialog ?? fullscreenDialog ?? false,
restorationId: data?.restorationId ?? restorationId,
title: data?.title ?? title,
allowSnapshotting: data?.allowSnapshotting ?? allowSnapshotting,
);
}
}