Repository navigation
[android 15] Status bar text not legible with edge to edge and light theme #160305
Copy link
Copy link
Closed
Closed
Copy link
Labels
P1High-priority issues at the top of the work listHigh-priority issues at the top of the work liste: OS-version specificAffects only some versions of the relevant operating systemAffects only some versions of the relevant operating systemframeworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.platform-androidAndroid applications specificallyAndroid applications specificallyr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-androidOwned by Android platform teamOwned by Android platform team
Description
Steps to reproduce
flutter create -e flutter_bugcd flutter_bug && flutter run
I am able to reproduce this bug on a Pixel 7a (android 15) both on the latest stable and master channels.
Expected results
Clearly legible text on the status bar
Actual results
The status bar text is legible only if the theme of the app is dark
Code sample
Code sample
import 'package:flutter/material.dart';
void main() {
runApp(const MainApp());
}
class MainApp extends StatelessWidget {
const MainApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Center(
child: Text('Hello World!'),
),
),
);
}
}
Flutter Doctor output
Doctor output
[✓] Flutter (Channel master, 3.28.0-1.0.pre.122, on EndeavourOS 6.12.4-arch1-1, locale
en_US.UTF-8)
• Flutter version 3.28.0-1.0.pre.122 on channel master at /usr/bin/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 7877a076a6 (11 hours ago), 2024-12-13 22:46:08 -0500
• Engine revision a9f7fa8ca6
• Dart version 3.7.0 (build 3.7.0-243.0.dev)
• DevTools version 2.41.0
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
• Android SDK at /home/damiano/Android/Sdk
• Platform android-35, build-tools 35.0.0
• Java binary at: /usr/lib/jvm/java-17-openjdk/bin/java
This JDK is specified in your Flutter configuration.
To change the current JDK, run: `flutter config --jdk-dir="path/to/jdk"`.
• Java version OpenJDK Runtime Environment (build 17.0.13+11)
• All Android licenses accepted.
[✓] Chrome - develop for the web
• CHROME_EXECUTABLE =
/var/lib/flatpak/app/com.google.Chrome/current/active/files/extra/chrome
[✓] Linux toolchain - develop for Linux desktop
• clang version 18.1.8
• cmake version 3.31.2
• ninja version 1.12.1
• pkg-config version 2.3.0
[✓] Android Studio (version 2024.2)
• Android Studio at /opt/android-studio/
• Flutter plugin version 83.0.3
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• android-studio-dir = /opt/android-studio/
• Java version OpenJDK Runtime Environment (build 21.0.3+-12282718-b509.11)
[!] Android Studio (version unknown)
• Android Studio at /opt/android-studio
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
✗ Unable to determine Android Studio version.
• Java version OpenJDK Runtime Environment (build 21.0.3+-12282718-b509.11)
[✓] Connected device (3 available)
• Pixel 7a (mobile) • 37281JEHN00912 • android-arm64 • Android 15 (API 35)
• Linux (desktop) • linux • linux-x64 • EndeavourOS 6.12.4-arch1-1
• Chrome (web) • chrome • web-javascript • Google Chrome 131.0.6778.139
[✓] Network resources
• All expected network resources are available.
! Doctor found issues in 1 category.Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P1High-priority issues at the top of the work listHigh-priority issues at the top of the work liste: OS-version specificAffects only some versions of the relevant operating systemAffects only some versions of the relevant operating systemframeworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.platform-androidAndroid applications specificallyAndroid applications specificallyr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-androidOwned by Android platform teamOwned by Android platform team
Activity
darshankawar commentedon Dec 16, 2024
@ferraridamiano
Can you try as below which seems to resolve the issue ?
ferraridamiano commentedon Dec 16, 2024
Thank you. Yes it works, shouldn't this be the default?
darshankawar commentedon Dec 17, 2024
@ferraridamiano I am not sure. Do you know if you noticed this in latest version only or was there in previous ones as well ?
ferraridamiano commentedon Dec 17, 2024
This happens only when edge to edge mode is enabled. So, in the previous stable version was ok
darshankawar commentedon Dec 18, 2024
@ferraridamiano
I found out that this is specific to Android 15 for which there's a migration guide mentioned in 3.27 announcement.
Please go through https://docs.flutter.dev/release/breaking-changes/default-systemuimode-edge-to-edge and see if it helps in resolving your case.
ferraridamiano commentedon Dec 18, 2024
The migration guide explains how to disable edge to edge mode. Of course it works by disabling this feature. But the problem is with this feature enabled and in the future it will not be possible to disable it
darshankawar commentedon Dec 18, 2024
Thanks for the update @ferraridamiano
Check #86248 (comment) and flutter/website#10755 which probably indicates it is known about status bar and navigation bar. Please see if it helps to know why you are seeing the reported behavior.
13 remaining items
jmagman commentedon Dec 23, 2024
I tried
flutter createwith the default counter app doesn't reproduce this. However, just removing the AppBar from the scaffold in the default counter app was enough to make the status bar white and not legible. Weirdly, it flashes black and then back to white.from lib/main.dart remove:
status_bar.mov
ferraridamiano commentedon Dec 24, 2024
For those of you that use
ThemeModein your app here is a workaround to this problem. The solution is based on the suggestion above.This is not the solution but only a workaround
jmagman commentedon Jan 7, 2025
We believe the
statusBarIconBrightnessdefault logic change may need to be changed at the Material/Cupertino design system layer, and not to modify the template.Will need to investigate where this change needs to happen further.
Piinks commentedon Jan 22, 2025
Sharing from an internal chat:
flutter/packages/flutter/lib/src/rendering/view.dart
Line 389 in e53bd2a
is where we look up to see if there is any style set to apply it to the view.
This issue is a tricky one, because it is the app bar that sets the style of the status bar by default, here:
flutter/packages/flutter/lib/src/material/app_bar.dart
Line 841 in e53bd2a
We could have the Scaffold do it, but then the absence of a Scaffold will present the same issue. The MaterialApp widget could do it, since it should have knowledge of the theme.. but that won't help folks not using MaterialApp.
I don't know if there is a way we could guarantee that we could always catch and handle this as expected, but curious to see what other folks think.
Piinks commentedon Jan 22, 2025
This is doable! We can alter the MaterialApp and CupertinoApp widgets to set a default style based on the theme brightness, just wondering what we might do when folks are not using these. Or if that is where the expectation ends. :)
jesswrd commentedon Jan 24, 2025
Evaluating some cases such as a Cupertino app on Android and Material on iOS to see if the bug shows up by default. And if not, why?
jesswrd commentedon Jan 24, 2025
The bug appears in the Cupertino app on Android when there is no CupertinoNavigationBar. @LouiseHsu confirmed the bug does not show up by default in Material and Cupertino on iOS.
jesswrd commentedon Feb 6, 2025
Made a doc investigating existing behavior of adopting/using a dark theme on Material here. It explains how Material currently handles using a dark theme. It also outlines the differences in handling between Cupertino and Material as well as some pros and cons of current handling in Material.
This doc can help with making sense of this thread on the PR here.
Fix Status Bar Icon Brightness (#162297)
github-actions commentedon Feb 24, 2025
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.