Anh Tran dev notes

Production bugs from mobile and backend work, written up with the fix and how it was checked.

Note 21 / Flutter / Android / Mobile

A dark Flutter app on Android 15 with a light gray navigation bar, and a white flash at launch

Dark app, light gray strip under the tab bar, white flash on every cold start. The Android 15 edge-to-edge rules behind both, the Flutter fix, and what I did not isolate.

By
Trần Thế Anh, Software Engineer
Published
Work done
October 2026, Dramma Short (Flutter, Android)
Stack
Flutter, SystemChrome overlay style, Android 15 edge-to-edge, Android 12 splash screen, iOS LaunchScreen storyboard
Reading
7 min, 1,365 words

During device QA of Dramma Short, a Flutter app with a near-black background, the tester reported two things from a Xiaomi phone. First, a light gray strip sat under the bottom tab bar, where the three-button navigation bar lives, and content scrolling behind the tab bar showed through it. Second, every cold start flashed white before the dark first screen appeared. I verified both fixes on that phone, which reports SDK 36. They look unrelated. Both come from the same fact. On a recent Android the system decides what is behind and around your app, and a template Flutter project gives it light defaults.

The gray strip under a dark app

When an app targets Android 15 (API 35) or higher, it is edge-to-edge by default on Android 15 devices. The Android 15 behavior-changes page lists what that does to the three-button navigation bar: it gets 80% opacity by default, its color follows the window background by default (the page says the window background must be a color drawable for that to apply), and navigationBarContrastEnforced is true by default, which adds an 80% opaque background across the bar. It also says setNavigationBarColor is deprecated but still affects three-button navigation. Gesture navigation is different: there the bar is transparent and the color APIs do nothing.

Flutter’s own documentation for systemNavigationBarContrastEnforced describes the same thing from the Dart side. On SDK 29 and up a translucent scrim may appear behind the navigation buttons, and setting the flag to false removes it. The property is nullable and the page gives no explicit default, so leaving it unset means the system behavior.

My app used SystemUiOverlayStyle.light and nothing else. That sets light icons and says nothing about the bar’s color or the scrim. The app targets flutter.targetSdkVersion; the Flutter installed on my machine sets it to 36, so the enforcement applies. I did not look at how the Flutter embedding applies edge-to-edge on Android, only at the result on the device.

The fix is two properties in the overlay style, set once at startup:

SystemChrome.setSystemUIOverlayStyle(
  SystemUiOverlayStyle.light.copyWith(
    systemNavigationBarColor: AppColors.background, // the app's own near-black
    systemNavigationBarIconBrightness: Brightness.light,
    systemNavigationBarContrastEnforced: false,
  ),
);

On the Xiaomi phone the system bar became dark and the tab bar sat on a dark strip. I should be honest about what I did not separate. The commit sets the color and turns the scrim off in the same change, so I cannot tell you which of the two removed the gray on that phone. The comment I left in the code blames the vendor skin’s default, which is a guess about MIUI; it is not something I verified against the vendor’s source.

Why the list showed through the tab bar

The gray strip was only half of the report. The tab bar itself had a transparent background, because the design file draws it over a flat color. In the real app the list scrolls under it, so rows and thumbnails ran through the tab labels. Making the system bar dark did not fix that, because this part was my widget, not the system.

The bar is now a frosted layer: a BackdropFilter with a blur of sigma 20 inside a ClipRect, over a translucent background color. The fix commit used the app background at 85% opacity. A commit the next day replaced that with a slightly blue translucent color, so the exact value in the repo today is not the one from this bug. The shape of the widget is what matters, and it is the same (rewritten, names changed):

ClipRect(
  child: BackdropFilter(
    filter: ImageFilter.blur(sigmaX: 20, sigmaY: 20),
    child: Container(
      color: AppColors.navBarGlass,
      padding: EdgeInsets.fromLTRB(8, 12, 8, systemBottomInset),
      child: tabRow,
    ),
  ),
)

The white flash comes from the template

A new Flutter project ships with a launch background that is white. On Android, the activity is created with LaunchTheme, whose windowBackground points at a drawable. The Flutter engine needs some time to draw its first frame, and until then the user sees that drawable. My LaunchTheme used @drawable/launch_background, and that drawable’s layer list used @android:color/white. The theme Flutter switches to afterwards, NormalTheme, had windowBackground set to ?android:colorBackground, which for a light parent theme is a light color. The iOS LaunchScreen.storyboard had its view background at red, green and blue all 1.0.

Android 12 added a second layer. Apps launch with a system splash screen, which the Android developer documentation says uses the theme’s windowBackground by default if that is a single color. My windowBackground was a layer-list drawable, not a bare color, so I set the splash background explicitly. I did not test whether the splash would have picked up the drawable on its own, so treat the explicit attribute as a precaution I am sure works, not as proof it was needed.

The fix defines one color resource and uses it everywhere the launch path can reach:

<!-- values/colors.xml -->
<color name="launch_background">#0A0A0A</color>

<!-- launch_background.xml (layer-list): the fill item was @android:color/white -->
<item android:drawable="@color/launch_background" />

<!-- values/styles.xml and values-night/styles.xml, NormalTheme -->
<item name="android:windowBackground">@color/launch_background</item>

<!-- values-v31/styles.xml, LaunchTheme: Android 12+ system splash -->
<item name="android:windowSplashScreenBackground">@color/launch_background</item>

On iOS the storyboard background went to about 0.039 on each channel, which is the same #0A0A0A. I checked Android on the Xiaomi phone by taking a screenshot about 0.4 seconds after am start: the background was black and the white frame was gone. I did not run the iOS change on a device in this pass, so I know the storyboard now says the right color but I have not seen the iOS launch itself.

The Android 15 page says the three-button bar takes its color from the window background by default. Before the launch fix, NormalTheme had a light windowBackground. That is a plausible reason the bar came out light even before any contrast scrim, and it would mean the launch fix also helps the gray strip. I have not tested it. I did not revert the theme change to see whether the gray came back, so this stays a hypothesis from reading the two documents side by side. It is the main thing I would check first if the gray strip returned.

Scanning the whole class

For the launch screens, the sweep I used after the fix is a grep over the resource folders:

grep -rn "color/white\|colorBackground\|red=\"1\" green=\"1\"" \
  android/app/src/main/res ios/Runner/Base.lproj

It returned zero hits after the fix. It looks for the three ways the template says “white”: the Android white color, the theme’s default background attribute, and the storyboard’s full-white channel values. It does not look at a dark-mode variant I might add later, so a new values-night file needs the same check.

For the system bars, I had no command. The sweep was manual: I opened every screen that shows the five-tab bar on the Xiaomi phone and looked at the bottom edge. That is a weak check. It covers one vendor skin and one Android version, and it would miss a screen that hides the tab bar or changes the system bar style on its own. A screen that calls setSystemUIOverlayStyle itself can undo the global setting. In this app grep -rn setSystemUIOverlayStyle lib finds one call, in main.dart, so nothing overrides it; the first thing to run in another codebase is that same grep.

What I would carry to the next app

Any app with a dark theme needs three native places to agree with the Flutter background: the system navigation bar (color and contrast scrim), the Android launch theme with the Android 12 splash attribute, and the iOS launch storyboard. A template gives all three a light value. Change them at the same time you set the app theme, not when a tester reports them, and look at the result on a three-button device as well as a gesture-navigation one, because the two behave differently under the same Android 15 rules.

Sources