platformPage function

Page platformPage({
  1. required BuildContext context,
  2. Widget? child,
  3. String? title,
  4. String? name,
  5. bool? maintainState,
  6. bool? fullscreenDialog,
  7. LocalKey? key,
  8. String? restorationId,
  9. Object? arguments,
  10. bool allowSnapshotting = true,
  11. PlatformBuilder<MaterialPageData>? material,
  12. 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,
    );
  }
}