buildSplashYaml static method
String
buildSplashYaml(
- RebrandConfig config, {
- required String imagePath,
- String? darkImagePath,
- required String android12ImagePath,
- String? android12DarkImagePath,
Implementation
static String buildSplashYaml(
RebrandConfig config, {
required String imagePath,
String? darkImagePath,
required String android12ImagePath,
String? android12DarkImagePath,
}) {
final lines = <String>['flutter_native_splash:'];
_addYamlLine(lines, 'color', config.splashColor, indent: 2);
_addYamlLine(lines, 'image', imagePath, indent: 2);
_addYamlLine(lines, 'android_gravity', config.splashGravity, indent: 2);
_addYamlLine(
lines,
'ios_content_mode',
config.splashIOSContentMode,
indent: 2,
);
_addYamlLine(lines, 'android', config.enableAndroid, indent: 2);
_addYamlLine(lines, 'ios', config.enableIOS, indent: 2);
_addYamlLine(lines, 'fullscreen', config.splashFullscreen, indent: 2);
if (config.splashDarkColor != null) {
_addYamlLine(lines, 'color_dark', config.splashDarkColor!, indent: 2);
}
if (darkImagePath != null) {
_addYamlLine(lines, 'image_dark', darkImagePath, indent: 2);
}
if (config.splashWebImageMode != null) {
_addYamlLine(
lines,
'web_image_mode',
config.splashWebImageMode!,
indent: 2,
);
}
if (config.splashBranding != null) {
_addYamlLine(lines, 'branding', config.splashBranding!, indent: 2);
}
if (config.splashBrandingDark != null) {
_addYamlLine(
lines,
'branding_dark',
config.splashBrandingDark!,
indent: 2,
);
}
if (config.splashBrandingMode != null) {
_addYamlLine(
lines,
'branding_mode',
config.splashBrandingMode!,
indent: 2,
);
}
if (config.splashBrandingBottomPadding != null) {
_addYamlLine(
lines,
'branding_bottom_padding',
config.splashBrandingBottomPadding!,
indent: 2,
);
}
if (config.splashAndroidScreenOrientation != null) {
_addYamlLine(
lines,
'android_screen_orientation',
config.splashAndroidScreenOrientation!,
indent: 2,
);
}
if (config.enableAndroid) {
lines.add(' android_12:');
_addYamlLine(lines, 'color', config.android12Color, indent: 4);
_addYamlLine(lines, 'image', android12ImagePath, indent: 4);
if (config.android12DarkColor != null) {
_addYamlLine(
lines,
'color_dark',
config.android12DarkColor!,
indent: 4,
);
}
if (android12DarkImagePath != null) {
_addYamlLine(lines, 'image_dark', android12DarkImagePath, indent: 4);
}
if (config.android12IconBackgroundColor != null) {
_addYamlLine(
lines,
'icon_background_color',
config.android12IconBackgroundColor!,
indent: 4,
);
}
if (config.android12IconBackgroundDarkColor != null) {
_addYamlLine(
lines,
'icon_background_color_dark',
config.android12IconBackgroundDarkColor!,
indent: 4,
);
}
if (config.android12Branding != null) {
_addYamlLine(lines, 'branding', config.android12Branding!, indent: 4);
}
if (config.android12BrandingDark != null) {
_addYamlLine(
lines,
'branding_dark',
config.android12BrandingDark!,
indent: 4,
);
}
}
return '${lines.join('\n')}\n';
}