Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using systemNavigationBarDividerColor changes statusBarIconBrightness and systemNavigationBarIconBrightness on Android11 #100027

Closed
rydmike opened this issue Mar 13, 2022 · 15 comments
Labels
c: regression It was better in the past than it is now e: OS-version specific Affects only some versions of the relevant operating system engine flutter/engine repository. See also e: labels. found in release: 2.10 Found to occur in 2.10 found in release: 2.11 Found to occur in 2.11 framework flutter/packages/flutter repository. See also f: labels. has reproducible steps The issue has been confirmed reproducible and is ready to work on P2 Important issues not at the top of the work list platform-android Android applications specifically r: fixed Issue is closed as already fixed in a newer version

Comments

@rydmike
Copy link
Contributor

rydmike commented Mar 13, 2022

Steps to Reproduce

When you use an AnnotatedRegion to control the design of the system navigation bar on Android the
statusBarIconBrightness and systemNavigationBarIconBrightness unexpectedly change to Brightness.light if you give any value to systemNavigationBarDividerColor on Android 11 (SDK30).

To see the issue try the provided code sample with different Android SDK API versions.

Reproduction sample code
void main() {
  runApp(const MyApp());
}

final AppBarTheme appBarLight = AppBarTheme(
  backgroundColor: Colors.white.withAlpha(0xEE),
  foregroundColor: Colors.black,
  elevation: 0.5,
  systemOverlayStyle: SystemUiOverlayStyle.dark.copyWith(
    statusBarColor: Colors.transparent,
  ),
);

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Annotated Region Issue',
      theme: ThemeData.from(colorScheme: const ColorScheme.light())
          .copyWith(appBarTheme: appBarLight),
      home: const MyHomePage(title: 'Annotated Region Issue'),
    );
  }
}

class MyHomePage extends StatelessWidget {
  const MyHomePage({Key? key, required this.title}) : super(key: key);
  final String title;

  @override
  Widget build(BuildContext context) {
    final MediaQueryData media = MediaQuery.of(context);
    final double topPadding = media.padding.top + kToolbarHeight;
    final double bottomPadding = media.padding.bottom;
    SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
    return AnnotatedRegion(
      value: SystemUiOverlayStyle(
        systemNavigationBarColor: Colors.white.withAlpha(0xEE),
        systemNavigationBarDividerColor: Colors.transparent,
        systemNavigationBarIconBrightness: Brightness.dark,
        systemNavigationBarContrastEnforced: false,
      ),
      child: Scaffold(
        extendBody: true,
        extendBodyBehindAppBar: true,
        appBar: AppBar(
          title: Text(title),
        ),
        body: GridView.builder(
          padding:
              EdgeInsets.fromLTRB(10, topPadding + 10, 10, bottomPadding + 10),
          gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
            crossAxisCount: 3,
            mainAxisSpacing: 8,
            crossAxisSpacing: 8,
            childAspectRatio: 2,
          ),
          itemCount: 100,
          itemBuilder: (context, index) => Card(
            color: Colors.primaries[index % Colors.primaries.length][800]!,
            elevation: 2,
            child: Center(
              child: Text(
                'Tile nr ${index + 1}',
                style: const TextStyle(color: Colors.white, fontSize: 16),
              ),
            ),
          ),
        ),
      ),
    );
  }
}

Actual results

  • On Android 11 (SDK 30) the icons become light even though they are set to dark.
  • On Android 9 (SDK 28) the system navigation bar does not change to given color.
Android 9 (SDK 28) Android 10 (SDK 29) Android 11 (SDK 30) Android 12 (SDK 31)
FAIL OK FAIL OK
image image image image

Results from Pixel4XL at shown Android SDK API level using the 3 button system navigation style to make the results more visible. The results are the same with the smaller swipe navigation too, but not as visible.

Expected results

Expected that the system navigation bar icons and status bar icons would have remained dark on Android 11 (SDK 30) as in result from Android 10 (SDK 29) and Android 12 (SDK 31). Surprisingly even the status bar icons change their brightness, even though they are not set in the SystemUiOverlayStyle used in the AnnotatedRegion at all.

Expected that Android 9 (SDK 28) would have gotten a white system navigation bar with opacity. This was expected since the documentation states:

/// The color of the system bottom navigation bar.
///
/// Only honored in Android versions O and greater.
final Color? systemNavigationBarColor;

Since Android O, is Android Oreo, version 8.0 (SDK 26), then setting the systemNavigationBarColor should have worked also in this case with Android 9 (SDK 28), but as shown it did not change color.

Tested Flutter versions

The issue exists in latest Flutter stable 2.10.3 and master channel version shown below:

Flutter doctor from master
[√] Flutter (Channel master, 2.11.0-0.0.pre.870, on Microsoft Windows [Version 10.0.22000.556], locale en-US)
    • Flutter version 2.11.0-0.0.pre.870 at C:\Users\mryds\fvm\versions\master
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 2f73173c36 (2 days ago), 2022-03-11 15:00:16 -0500
    • Engine revision 6239bfb884
    • Dart version 2.17.0 (build 2.17.0-182.0.dev)
    • DevTools version 2.11.1

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at C:\Users\mryds\AppData\Local\Android\sdk
    • Platform android-31, build-tools 30.0.3
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 11.0.11+9-b60-7590822)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.11.9)
    • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
    • Visual Studio Community 2019 version 16.11.32106.194
    • Windows 10 SDK version 10.0.19041.0

[√] Android Studio (version 2021.1)
    • Android Studio at C:\Program Files\Android\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
    • Java version OpenJDK Runtime Environment (build 11.0.11+9-b60-7590822)

[√] IntelliJ IDEA Community Edition (version 2021.3)
    • IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2018.3.1
    • Flutter plugin version 65.2.4
    • Dart plugin version 213.7227

[√] VS Code (version 1.65.2)
    • VS Code at C:\Users\mryds\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.36.0

[√] Connected device (4 available)
    • sdk gphone x86 64 arm64 (mobile) • emulator-5554 • android-x64    • Android 11 (API 30) (emulator)
    • Windows (desktop)                • windows       • windows-x64    • Microsoft Windows [Version 10.0.22000.556]   
    • Chrome (web)                     • chrome        • web-javascript • Google Chrome 99.0.4844.51
    • Edge (web)                       • edge          • web-javascript • Microsoft Edge 99.0.1150.30

[√] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

System navigation bar divider is a surface layer, not a divider line

If you on Android 10, 11 and 12 set systemNavigationBarDividerColor to a color with opacity, then the system navigation bar becomes almost opaque and no longer has the opacity defined by systemNavigationBarColor. As shown here:

return AnnotatedRegion(
      value: SystemUiOverlayStyle(
        systemNavigationBarColor: Colors.white.withAlpha(0xEE),
        systemNavigationBarDividerColor: Colors.white.withAlpha(0xEE),
        systemNavigationBarIconBrightness: Brightness.dark,
        systemNavigationBarContrastEnforced: false,
      ),

It seems like the systemNavigationBarDividerColor is a full layer behind the navigation bar with just a 1dp higher height. We can test this theory with separate colors on divider and the system navigation bar, with both having suitable opacity:

return AnnotatedRegion(
      value: SystemUiOverlayStyle(
        systemNavigationBarColor: Colors.white.withAlpha(0xBB),
        systemNavigationBarDividerColor: Colors.red.withAlpha(0x55),
        systemNavigationBarIconBrightness: Brightness.dark,
        systemNavigationBarContrastEnforced: false,
      ),

Which reveals that this is in fact the case. Here we can see a translucent white surface on the navigation bar, showing the translucent red divider surface behind it, with it reaching about 1dp higher and top part being visible as a red semi transparent line.

To not have any impact from the systemNavigationBarDividerColor on the systemNavigationBarColor with opacity, you have to use fully transparent color Colors.transparent on the divider color.

Knowing that the divider color is in fact the color of a full surface behind the system navigation bar that is just 1dp higher than navigation bar area, and not a divider line, is a critical piece of information when dealing with how to use it when using opacity on the system navigation bar background. You can use this knowledge to create a system navigation bar area that has some transparency and a divider, but the transparency will be a sum of both colors and their transparency.

Consider documenting this critical information about the system navigation bar divider.

SystemUiOverlayStyle Documentation

Consider using clearer documentation of what feature is supported on which versions for each property in SystemUiOverlayStyle.

Prefer always stating Android version and SDK API level. Avoid using internal code version letters like "O" and "P", instead prefer saying "Android 8 (SDK 26)" and "Android 10 (SDK 29)".

Avoid using terms like SDK 29+, it is unclear if this means 29 and higher or higher than 29. Fortunately the docs do mention the unambiguous version too, but in some cases with the confusing Android one letter version code. Why include the ambiguous version at all?

Examples:

  • "in SDK 29+, or Android 10 and up", instead consider "in Android 10 (SDK 29) and up"
  • "SDK 28-, or Android P and lower", instead consider "in Android 9 (SDK 28) and lower"

Related issues

At least these issues touch subjects related to this issue, but are slightly different.

@danagbemava-nc
Copy link
Member

Reproducible on stable and master.

screenshots
android 11 android 12
complete code sample
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

void main() {
  runApp(const MyApp());
}

final AppBarTheme appBarLight = AppBarTheme(
  backgroundColor: Colors.white.withAlpha(0xEE),
  foregroundColor: Colors.black,
  elevation: 0.5,
  systemOverlayStyle: SystemUiOverlayStyle.dark.copyWith(
    statusBarColor: Colors.transparent,
  ),
);

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Annotated Region Issue',
      theme: ThemeData.from(colorScheme: const ColorScheme.light())
          .copyWith(appBarTheme: appBarLight),
      home: const MyHomePage(title: 'Annotated Region Issue'),
    );
  }
}

class MyHomePage extends StatelessWidget {
  const MyHomePage({Key? key, required this.title}) : super(key: key);
  final String title;

  @override
  Widget build(BuildContext context) {
    final MediaQueryData media = MediaQuery.of(context);
    final double topPadding = media.padding.top + kToolbarHeight;
    final double bottomPadding = media.padding.bottom;
    SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
    return AnnotatedRegion(
      value: SystemUiOverlayStyle(
        systemNavigationBarColor: Colors.white.withAlpha(0xBB),
        systemNavigationBarDividerColor: Colors.red.withAlpha(0x55),
        systemNavigationBarIconBrightness: Brightness.dark,
        systemNavigationBarContrastEnforced: false,
      ),
      child: Scaffold(
        extendBody: true,
        extendBodyBehindAppBar: true,
        appBar: AppBar(
          title: Text(title),
        ),
        body: GridView.builder(
          padding:
              EdgeInsets.fromLTRB(10, topPadding + 10, 10, bottomPadding + 10),
          gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
            crossAxisCount: 3,
            mainAxisSpacing: 8,
            crossAxisSpacing: 8,
            childAspectRatio: 2,
          ),
          itemCount: 100,
          itemBuilder: (context, index) => Card(
            color: Colors.primaries[index % Colors.primaries.length][800]!,
            elevation: 2,
            child: Center(
              child: Text(
                'Tile nr ${index + 1}',
                style: const TextStyle(color: Colors.white, fontSize: 16),
              ),
            ),
          ),
        ),
      ),
    );
  }
}
flutter doctor -v
[✓] Flutter (Channel stable, 2.10.3, on macOS 12.2.1 21D62 darwin-arm, locale en-GB)
    • Flutter version 2.10.3 at /Users/nexus/dev/sdks/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 7e9793dee1 (12 days ago), 2022-03-02 11:23:12 -0600
    • Engine revision bd539267b4
    • Dart version 2.16.1
    • DevTools version 2.9.2

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at /Users/nexus/Library/Android/sdk
    • Platform android-32, build-tools 31.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • 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
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)

[☠] IntelliJ IDEA Community Edition (the doctor check crashed)
    ✗ Due to an error, the doctor check did not complete. If the error message below is not helpful, please let us know about this issue at https://github.com/flutter/flutter/issues.
    ✗ FormatException: Unexpected extension byte (at offset 5)
    • #0      _Utf8Decoder.convertSingle (dart:convert-patch/convert_patch.dart:1789:7)
      #1      Utf8Decoder.convert (dart:convert/utf.dart:351:42)
      #2      InputStream.readString (package:archive/src/util/input_stream.dart:207:30)
      #3      new ZipDirectory.read (package:archive/src/zip/zip_directory.dart:40:30)
      #4      ZipDecoder.decodeBuffer (package:archive/src/zip_decoder.dart:19:30)
      #5      ZipDecoder.decodeBytes (package:archive/src/zip_decoder.dart:14:12)
      #6      IntelliJPlugins._findPluginXml (package:flutter_tools/src/intellij/intellij.dart:130:44)
      #7      IntelliJPlugins._readPackageVersion (package:flutter_tools/src/intellij/intellij.dart:141:40)
      #8      IntelliJPlugins.validatePackage (package:flutter_tools/src/intellij/intellij.dart:63:35)
      #9      IntelliJValidator.validate (package:flutter_tools/src/intellij/intellij_validator.dart:103:15)
      #10     asyncGuard.<anonymous closure> (package:flutter_tools/src/base/async_guard.dart:111:32)
      #11     asyncGuard.<anonymous closure> (package:flutter_tools/src/base/async_guard.dart:109:18)
      #12     _rootRun (dart:async/zone.dart:1426:13)
      #13     _CustomZone.run (dart:async/zone.dart:1328:19)
      #14     _runZoned (dart:async/zone.dart:1861:10)
      #15     runZonedGuarded (dart:async/zone.dart:1849:12)
      #16     runZoned (dart:async/zone.dart:1780:12)
      #17     asyncGuard (package:flutter_tools/src/base/async_guard.dart:109:3)
      #18     Doctor.startValidatorTasks (package:flutter_tools/src/doctor.dart:205:9)
      #19     Doctor.diagnose (package:flutter_tools/src/doctor.dart:309:47)
      #20     DoctorCommand.runCommand (package:flutter_tools/src/commands/doctor.dart:50:48)
      #21     FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:1320:12)
      <asynchronous suspension>
      #22     FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1161:27)
      <asynchronous suspension>
      #23     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
      <asynchronous suspension>
      #24     CommandRunner.runCommand (package:args/command_runner.dart:209:13)
      <asynchronous suspension>
      #25     FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:281:9)
      <asynchronous suspension>
      #26     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
      <asynchronous suspension>
      #27     FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:229:5)
      <asynchronous suspension>
      #28     run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:62:9)
      <asynchronous suspension>
      #29     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
      <asynchronous suspension>
      #30     main (package:flutter_tools/executable.dart:94:3)
      <asynchronous suspension>


[✓] VS Code (version 1.65.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.36.0

[✓] Connected device (3 available)
    • sdk gphone arm64 (mobile) • emulator-5554 • android-arm64  • Android 11 (API 30) (emulator)
    • macOS (desktop)           • macos         • darwin-arm64   • macOS 12.2.1 21D62 darwin-arm
    • Chrome (web)              • chrome        • web-javascript • Google Chrome 99.0.4844.51

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 1 category.
[✓] Flutter (Channel master, 2.11.0-0.0.pre.871, on macOS 12.2.1 21D62 darwin-arm, locale en-GB)
    • Flutter version 2.11.0-0.0.pre.871 at /Users/nexus/dev/sdks/flutters
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 4f4c7816c3 (4 hours ago), 2022-03-14 07:35:07 +0100
    • Engine revision 6239bfb884
    • Dart version 2.17.0 (build 2.17.0-182.0.dev)
    • DevTools version 2.11.1

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at /Users/nexus/Library/Android/sdk
    • Platform android-32, build-tools 31.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • 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
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)

[✓] IntelliJ IDEA Community Edition (version 2021.3)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin version 213.5744.122

[✓] VS Code (version 1.65.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.36.0

[✓] Connected device (3 available)
    • sdk gphone arm64 (mobile) • emulator-5554 • android-arm64  • Android 11 (API 30) (emulator)
    • macOS (desktop)           • macos         • darwin-arm64   • macOS 12.2.1 21D62 darwin-arm
    • Chrome (web)              • chrome        • web-javascript • Google Chrome 99.0.4844.51

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

@danagbemava-nc danagbemava-nc added platform-android Android applications specifically framework flutter/packages/flutter repository. See also f: labels. engine flutter/engine repository. See also e: labels. e: OS-version specific Affects only some versions of the relevant operating system has reproducible steps The issue has been confirmed reproducible and is ready to work on found in release: 2.10 Found to occur in 2.10 found in release: 2.11 Found to occur in 2.11 and removed in triage Presently being triaged by the triage team labels Mar 14, 2022
@zanderso
Copy link
Member

cc @blasten

@zanderso zanderso added the P2 Important issues not at the top of the work list label Mar 14, 2022
@blasten
Copy link

blasten commented Mar 14, 2022

I thought this was a regression, but I don't see any changes that affected these code paths during this time window.
The commits reverted in flutter/engine#32007 didn't make it to the stable version.

@camsim99 could you investigate this further since you have been working with status bars recently?

@blasten
Copy link

blasten commented Mar 14, 2022

Potentially related to:
flutter/engine#27018 and flutter/engine#28206

cc @Piinks

@Piinks Piinks self-assigned this Mar 16, 2022
@Piinks Piinks added the c: regression It was better in the past than it is now label Mar 16, 2022
@Piinks
Copy link
Contributor

Piinks commented Mar 16, 2022

It looks like this is about more than one issue, regarding the android navigation bar color not changing:

@camsim99 and I bisected this to a #97883
It looks like the system chrome style is not being applied as it was before.
FYI @jonahwilliams

@camsim99 has more context re: the divider color behavior.

To avoid confusion and focus on a solution to each of these issues, they are likely best served as individual bugs.

@jonahwilliams
Copy link
Member

Ahh, lets revert for now then

@jonahwilliams
Copy link
Member

revert is #100263

@camsim99
Copy link
Contributor

On the systemNavigationBarDividerColor impacting setting the icon brightness issue, it seems like there was a missing window flag that needed to be set for it to work. I'm still investigating the systemNavigationBarDividerColor impacting a transparent navigation bar issue, but I'll update here with a PR making the fixes when I do.

@Piinks Piinks removed their assignment Mar 17, 2022
@Piinks
Copy link
Contributor

Piinks commented Mar 17, 2022

Thanks @jonahwilliams & @camsim99.

From the reproduction, I can also see there are a combination of different system chrome styles being applied, one through the app bar and the other through the annotated region. For each issue listed, a minimal reproduction of code should make it easier to identify each root cause.

@camsim99
Copy link
Contributor

This PR should fix the API 30 issue with setting system bar icon brightness on API 30.

In terms of the issue with having a translucent navigation bar and setting the divider color, this is due to the underlying Android API we need to use in order to style the system bars, so I will send out a PR to note this in the documentation as @rydmike suggested.

@rydmike
Copy link
Contributor Author

rydmike commented Mar 24, 2022

@Piinks and @camsim99,

Regarding the system chrome style via the AppBar. In an app you don't really have much choice than using both SystemUiOverlayStyle via both the AppBar (as long as the app/page in question has an AppBar and an AnnotatedRegion, if you want to style both, because:

  1. The AppBar always makes a default SystemUiOverlayStyle, it uses a default one if you did not specify one.
  2. Defining a custom systemOverlayStyle for the AppBar and in it specifying any SystemUiOverlayStyle properties that concern the system navigation bar, by using any of its systemNavigationBar* properties have no impact at all on the Android system navigation bar when used via the AppBar!
  3. Thus if your screen/app has an AppBar and you want to style both the Android AppBar and its system navigation bar, you have to do it using both the AppBar and an extra AnnotatedRegion.

I find it both a bit confusing and frustrating that if you have an AppBar and are already styling its status bar with its systemOverlayStyle, that you can't at the same time define the desired properties for the system navigation bar, via same systemOverlayStyle. All the props for systemNavigationBar* are there in the same SystemUiOverlayStyle, they just don't do anything to the system navigation bar if you try to use them via the AppBar.

One could argue that this makes sense, since we are defining things for an AppBar that does not really have anything to do with the system navigation bar. On the other hand the properties are there, if they have no impact, they should not exists at all in the used AppBar "systemOverlayStyle" config class. Or at the least it is should be very clearly documented that they have no impact and that you have to set them via an AnnotatedRegion. But why not let them work also via the AppBar?

Imo it would be very convenient in many cases if setting them also worked via the AppBar. Since the AppBar is usually closer in the Widget tree than an AnnotatedRegion, its settings would have precedence also for the system navigation bar, if both are specified.

The AnnotatedRegion is of course needed for styling both status bar and system navigation bar in screens/apps that do not have an AppBar.

@camsim99
Copy link
Contributor

Un-assigning myself as I'm not actively working on this.

@camsim99 camsim99 removed their assignment Jan 30, 2023
@bgoncharuck
Copy link

SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
    systemNavigationBarColor: Color(0x0A000000),
  ))

@rydmike
Copy link
Contributor Author

rydmike commented Mar 14, 2023

I re-tested this with Android versions from 9 to 13. I could no longer reproduce any of the actual issues reported above on Android 9 and 11 in Flutter stable 3.7.7, so I'm closing this issue as fixed and completed.

There are other aspect about the AnnotatedRegion and SystemUiOverlayStyle that may still benefit from improvements in usability in documentation, but other issue have or are capturing that.

@rydmike rydmike closed this as completed Mar 14, 2023
rydmike added a commit to rydmike/flex_color_scheme that referenced this issue Mar 15, 2023
- The issue flutter/flutter#100027 behind the divider removal was solved, so it could be enabled again.
- Added back a bunch of tests for it.
- Improve tinted effects and tinted disabled doc comments
- Clean out old TODOs and commented code.
@danagbemava-nc danagbemava-nc added the r: fixed Issue is closed as already fixed in a newer version label Mar 15, 2023
@github-actions
Copy link

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 -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
c: regression It was better in the past than it is now e: OS-version specific Affects only some versions of the relevant operating system engine flutter/engine repository. See also e: labels. found in release: 2.10 Found to occur in 2.10 found in release: 2.11 Found to occur in 2.11 framework flutter/packages/flutter repository. See also f: labels. has reproducible steps The issue has been confirmed reproducible and is ready to work on P2 Important issues not at the top of the work list platform-android Android applications specifically r: fixed Issue is closed as already fixed in a newer version
Projects
None yet
Development

No branches or pull requests

8 participants