Skip to content

Commit 1e94f2e

Browse files
Copilotujas-m-simformsolutions
authored andcommitted
fix: 🐛 Android 12+ takes color as static value instead from styles
1 parent e8df2a5 commit 1e94f2e

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

lib/cmd/android_splash.dart

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,14 @@ Future<void> createColors({
171171
final androidValuesFolder = isDark
172172
? CmdStrings.androidDarkValuesDirectory
173173
: CmdStrings.androidValuesDirectory;
174+
175+
/// Create the directory if it doesn't exist (needed for values-night)
176+
final directory = Directory(androidValuesFolder);
177+
if (!await directory.exists()) {
178+
await directory.create(recursive: true);
179+
log('Created $androidValuesFolder directory');
180+
}
181+
174182
final colorsFilePath = '$androidValuesFolder/${AndroidStrings.colorXml}';
175183

176184
final xmlFile = File(colorsFilePath);
@@ -304,13 +312,14 @@ Future<void> createAndroid12Styles({
304312
},
305313
nest: () {
306314
/// Creating a item element for color
315+
/// Use color reference from colors.xml so Android uses light/dark mode colors
307316
if (color != null) {
308317
builder.element(
309318
AndroidStrings.itemElement,
310319
attributes: {
311320
AndroidStrings.nameAttr: AndroidStrings.windowSplashScreenBG,
312321
},
313-
nest: color,
322+
nest: AndroidStrings.androidDrawableAttrVal,
314323
);
315324
}
316325

0 commit comments

Comments
 (0)