createCupertinoWidget method Null safety

  1. @override
CupertinoNavigationBar createCupertinoWidget(
  1. BuildContext context
)
override

Implementation

@override
CupertinoNavigationBar createCupertinoWidget(BuildContext context) {
  final data = cupertino?.call(context, platform(context));

  var trailing = trailingActions?.isEmpty ?? true
      ? null
      : Row(
          mainAxisSize: MainAxisSize.min,
          crossAxisAlignment: CrossAxisAlignment.stretch,
          children: trailingActions!,
        );

  final providerState = PlatformProvider.of(context);
  final noMaterialParent = data?.noMaterialParent ?? false;
  final useMaterial = (!noMaterialParent) &&
      (providerState?.settings.iosUsesMaterialWidgets ?? false);

  final heroTag = data?.heroTag;
  if (heroTag != null) {
    return CupertinoNavigationBar(
      key: data?.widgetKey ?? widgetKey,
      middle: data?.title ?? title,
      backgroundColor: data?.backgroundColor ?? backgroundColor,
      automaticallyImplyLeading: data?.automaticallyImplyLeading ??
          automaticallyImplyLeading ??
          true,
      automaticallyImplyMiddle: data?.automaticallyImplyMiddle ?? true,
      previousPageTitle: data?.previousPageTitle,
      padding: data?.padding,
      border: data?.border ?? _kDefaultNavBarBorder,
      leading: (data?.leading ?? leading)?.withMaterial(useMaterial),
      trailing: (data?.trailing ?? trailing)?.withMaterial(useMaterial),
      transitionBetweenRoutes: data?.transitionBetweenRoutes ?? true,
      brightness: data?.brightness,
      heroTag: heroTag,
    );
  }

  return CupertinoNavigationBar(
    key: data?.widgetKey ?? widgetKey,
    middle: data?.title ?? title,
    backgroundColor: data?.backgroundColor ?? backgroundColor,
    automaticallyImplyLeading:
        data?.automaticallyImplyLeading ?? automaticallyImplyLeading ?? true,
    automaticallyImplyMiddle: data?.automaticallyImplyMiddle ?? true,
    previousPageTitle: data?.previousPageTitle,
    padding: data?.padding,
    border: data?.border ?? _kDefaultNavBarBorder,
    leading: (data?.leading ?? leading)?.withMaterial(useMaterial),
    trailing: (data?.trailing ?? trailing)?.withMaterial(useMaterial),
    transitionBetweenRoutes: data?.transitionBetweenRoutes ?? true,
    brightness: data?.brightness,
    //heroTag: , used above
  );
}