showCupertino function
this centralizes code to determine if we want to display the cupertino version or the material version, since this can be determined by several settings throughout the package
Implementation
bool showCupertino(
BuildContext? context,
bool? showMaterialonIOS, {
bool mockIOS = false,
}) {
bool defaultValue = false;
// don't show on web
if (kIsWeb) return defaultValue;
// if we are on iOS then determine if we want material
if (mockIOS || Platform.isIOS) {
// if showMaterialonIOS not specified calculate it
if (showMaterialonIOS == null) {
showMaterialonIOS = defaultValue;
if (context != null)
// set showMaterialOnIOS to parent CardSettings value
showMaterialonIOS =
CardSettings.of(context)?.showMaterialonIOS ?? defaultValue;
}
return !showMaterialonIOS;
}
// material by default
return defaultValue;
}