From 146ea07abde860b7d7ed383888e2fc2678478ed6 Mon Sep 17 00:00:00 2001 From: Camille Simon <43054281+camsim99@users.noreply.github.com> Date: Wed, 25 Sep 2024 12:41:18 -0700 Subject: [PATCH] [Android] Update `SystemUiMode` and `setSystemChromeEnabledSystemUIMode ` docs to note targeting Android 15+ change (#153466) Updates `SystemUiMode` and `setSystemChromeEnabledSystemUIMode` documentation to reflect that edge-to-edge mode is used by default if the Flutter app targets Android 15. Part of https://github.com/flutter/flutter/issues/150367 and framework counterpart to https://github.com/flutter/engine/pull/54560. --- .../lib/src/services/system_chrome.dart | 46 ++++++++++++++++--- 1 file changed, 39 insertions(+), 7 deletions(-) diff --git a/packages/flutter/lib/src/services/system_chrome.dart b/packages/flutter/lib/src/services/system_chrome.dart index 515216f8a0..25a0dad16e 100644 --- a/packages/flutter/lib/src/services/system_chrome.dart +++ b/packages/flutter/lib/src/services/system_chrome.dart @@ -92,12 +92,21 @@ enum SystemUiOverlay { /// These modes mimic Android-specific display setups. /// /// Used by [SystemChrome.setEnabledSystemUIMode]. +/// +/// Flutter apps use [SystemUiMode.edgeToEdge] by default and setting any +/// of the other [SystemUiMode]s will NOT work unless you perform the migration +/// detailed in +/// https://docs.flutter.dev/release/breaking-changes/default-systemuimode-edge-to-edge. enum SystemUiMode { /// Fullscreen display with status and navigation bars presentable by tapping /// anywhere on the display. /// - /// Available starting at SDK 16 or Android J. Earlier versions of Android - /// will not be affected by this setting. + /// Available starting at Android SDK 4.1 (API 16). Earlier versions of Android + /// will not be affected by this setting. However, if your app targets Android + /// SDK 15 (API 35) or later (Flutter does this by default), then you must + /// migrate using the instructions in + /// https://docs.flutter.dev/release/breaking-changes/default-systemuimode-edge-to-edge + /// to use this mode. /// /// For applications running on iOS, the status bar and home indicator will be /// hidden for a similar fullscreen experience. @@ -114,8 +123,12 @@ enum SystemUiMode { /// Fullscreen display with status and navigation bars presentable through a /// swipe gesture at the edges of the display. /// - /// Available starting at SDK 19 or Android K. Earlier versions of Android - /// will not be affected by this setting. + /// Available starting at Android SDK 4.4 (API 19). Earlier versions of + /// Android will not be affected by this setting. However, if your app targets + /// Android SDK 15 (API 35) or later (Flutter does this by default), then you + /// must migrate using the instructions in + /// https://docs.flutter.dev/release/breaking-changes/default-systemuimode-edge-to-edge + /// to use this mode. /// /// For applications running on iOS, the status bar and home indicator will be /// hidden for a similar fullscreen experience. @@ -133,8 +146,12 @@ enum SystemUiMode { /// Fullscreen display with status and navigation bars presentable through a /// swipe gesture at the edges of the display. /// - /// Available starting at SDK 19 or Android K. Earlier versions of Android - /// will not be affected by this setting. + /// Available starting at Android SDK 4.4 (API 19). Earlier versions of + /// Android will not be affected by this setting. However, if your app targets + /// Android SDK 15 (API 35) or later (Flutter does this by default), then you + /// must migrate using the instructions in + /// https://docs.flutter.dev/release/breaking-changes/default-systemuimode-edge-to-edge + /// to use this mode. /// /// For applications running on iOS, the status bar and home indicator will be /// hidden for a similar fullscreen experience. @@ -151,9 +168,13 @@ enum SystemUiMode { /// Fullscreen display with status and navigation elements rendered over the /// application. /// - /// Available starting at SDK 29 or Android 10. Earlier versions of Android + /// Available starting at Android SDK 10 (API 29). Earlier versions of Android /// will not be affected by this setting. /// + /// If your app targets Android SDK 15 (API 35) or later (Flutter does this by + /// default), then this mode is used by default on Android. This mode is also + /// used by default on iOS. + /// /// For applications running on iOS, the status bar and home indicator will be /// visible. /// @@ -181,6 +202,11 @@ enum SystemUiMode { /// /// Omitting both overlays will result in the same configuration as /// [SystemUiMode.leanBack]. + /// + /// If your app targets Android SDK 15 (API 35) or later, then you must + /// migrate using the instructions in + /// https://docs.flutter.dev/release/breaking-changes/default-systemuimode-edge-to-edge + /// to use this mode. manual, } @@ -502,6 +528,12 @@ abstract final class SystemChrome { /// is true, the application is not fullscreen. See /// [SystemChrome.setSystemUIChangeCallback] to respond to these changes in a /// fullscreen application. + /// + /// If your app targets Android SDK 15 (API 35) or later (Flutter does this by + /// default), then your Flutter app uses [SystemUiMode.edgeToEdge] by default + /// on Android and setting any of the other [SystemUiMode]s will NOT work + /// unless you perform the migration detailed in + /// https://docs.flutter.dev/release/breaking-changes/default-systemuimode-edge-to-edge. static Future setEnabledSystemUIMode(SystemUiMode mode, { List? overlays }) async { if (mode != SystemUiMode.manual) { await SystemChannels.platform.invokeMethod(