applySplash function
Applies the splash screen on Android and iOS using details from the YAML file.
Implementation
Future<void> applySplash({
String? imageSource,
String? color,
String? gravity,
String? iosContentMode,
String? iosBackgroundContentMode,
YamlMap? android12AndAbove,
String? backgroundImageSource,
String? backgroundImageGravity,
String? darkImage,
String? darkColor,
String? darkGravity,
String? darkBackgroundImageSource,
}) async {
final iosSkipReasons = <String>[];
if (darkImage != null && imageSource == null) {
iosSkipReasons.add(
'For iOS, image is required when image_dark is provided. '
'Add image to provide the base Any appearance asset.',
);
}
if (darkBackgroundImageSource != null && backgroundImageSource == null) {
iosSkipReasons.add(
'For iOS, background_image is required when background_image_dark is provided. '
'Add background_image to provide the base Any appearance asset.',
);
}
if (iosSkipReasons.isNotEmpty) {
log('Skipping iOS splash generation: ${iosSkipReasons.join(' ')}');
log('Continuing with Android generation.');
} else {
await generateIosImages(
imageSource: imageSource,
color: color,
backgroundImage: backgroundImageSource,
iosContentMode: iosContentMode,
iosBackgroundContentMode: iosBackgroundContentMode,
darkImageSource: darkImage,
darkColor: darkColor,
darkBackgroundImage: darkBackgroundImageSource,
);
}
await applyAndroidSplashImage(
imageSource: imageSource,
color: color,
gravity: gravity,
android12AndAbove: android12AndAbove,
backgroundImageSource: backgroundImageSource,
backgroundImageGravity: backgroundImageGravity,
darkImage: darkImage,
darkColor: darkColor,
darkGravity: darkGravity,
darkBackgroundImageSource: darkBackgroundImageSource,
);
}