diff --git a/shell/platform/android/io/flutter/plugin/platform/PlatformPlugin.java b/shell/platform/android/io/flutter/plugin/platform/PlatformPlugin.java index 1bdc187d542..de4208e5461 100644 --- a/shell/platform/android/io/flutter/plugin/platform/PlatformPlugin.java +++ b/shell/platform/android/io/flutter/plugin/platform/PlatformPlugin.java @@ -15,8 +15,6 @@ import android.os.Build; import android.view.HapticFeedbackConstants; import android.view.SoundEffectConstants; import android.view.View; -import android.view.Window; -import android.util.Log; import io.flutter.plugin.common.ActivityLifecycleListener; import io.flutter.plugin.common.MethodChannel.MethodCallHandler; @@ -32,7 +30,6 @@ import org.json.JSONObject; */ public class PlatformPlugin implements MethodCallHandler, ActivityLifecycleListener { private final Activity mActivity; - private JSONObject mCurrentTheme; public static final int DEFAULT_SYSTEM_UI = View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN; private static final String kTextPlainFormat = "text/plain"; @@ -63,7 +60,7 @@ public class PlatformPlugin implements MethodCallHandler, ActivityLifecycleListe setSystemChromeEnabledSystemUIOverlays((JSONArray) arguments); result.success(null); } else if (method.equals("SystemChrome.setSystemUIOverlayStyle")) { - setSystemChromeSystemUIOverlayStyle((JSONObject) arguments); + setSystemChromeSystemUIOverlayStyle((String) arguments); result.success(null); } else if (method.equals("SystemNavigator.pop")) { popSystemNavigator(); @@ -221,70 +218,14 @@ public class PlatformPlugin implements MethodCallHandler, ActivityLifecycleListe updateSystemUiOverlays(); } - private void updateSystemUiOverlays(){ + private void updateSystemUiOverlays() { mActivity.getWindow().getDecorView().setSystemUiVisibility(mEnabledOverlays); - if (mCurrentTheme != null) { - setSystemChromeSystemUIOverlayStyle(mCurrentTheme); - } } - private void setSystemChromeSystemUIOverlayStyle(JSONObject message) { - Window window = mActivity.getWindow(); - View view = window.getDecorView(); - int flags = view.getSystemUiVisibility(); - try { - // You can change the navigation bar color (including translucent colors) - // in Android, but you can't change the color of the navigation buttons until Android O. - // LIGHT vs DARK effectively isn't supported until then. - // Build.VERSION_CODES.O - if (Build.VERSION.SDK_INT >= 26) { - if (!message.isNull("systemNavigationBarIconBrightness")) { - String systemNavigationBarIconBrightness = message.getString("systemNavigationBarIconBrightness"); - switch (systemNavigationBarIconBrightness) { - case "Brightness.dark": - //View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR - flags |= 0x10; - break; - case "Brightness.light": - if ((flags & 0x10) == 0x10) { - flags ^= 0x10; - } - break; - } - } - if (!message.isNull("systemNavigationBarColor")) { - window.setNavigationBarColor(message.getInt("systemNavigationBarColor")); - } - } - // Build.VERSION_CODES.M - if (Build.VERSION.SDK_INT >= 23) { - if (!message.isNull("statusBarIconBrightness")) { - String statusBarIconBrightness = message.getString("statusBarIconBrightness"); - switch (statusBarIconBrightness) { - case "Brightness.dark": - // View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR - flags |= 0x2000; - break; - case "Brightness.light": - if ((flags & 0x2000) == 0x2000) { - flags ^= 0x2000; - } - break; - } - } - if (!message.isNull("statusBarColor")) { - window.setStatusBarColor(message.getInt("statusBarColor")); - } - } - if (!message.isNull("systemNavigationBarDividerColor")) { - // Not availible until Android P. - // window.setNavigationBarDividerColor(systemNavigationBarDividerColor); - } - view.setSystemUiVisibility(flags); - mCurrentTheme = message; - } catch (JSONException err) { - Log.i("PlatformPlugin", err.toString()); - } + private void setSystemChromeSystemUIOverlayStyle(String style) { + // You can change the navigation bar color (including translucent colors) + // in Android, but you can't change the color of the navigation buttons, + // so LIGHT vs DARK effectively isn't supported in Android. } private void popSystemNavigator() { diff --git a/shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.mm b/shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.mm index 51df7e1aec9..c312cac28b3 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.mm @@ -137,12 +137,11 @@ using namespace shell; ![overlays containsObject:@"SystemUiOverlay.top"]; } -- (void)setSystemChromeSystemUIOverlayStyle:(NSDictionary*)message { - NSString* style = message[@"statusBarBrightness"] - UIStatusBarStyle statusBarStyle - if ([style isEqualToString:@"Brightness.light"]) +- (void)setSystemChromeSystemUIOverlayStyle:(NSString*)style { + UIStatusBarStyle statusBarStyle; + if ([style isEqualToString:@"SystemUiOverlayStyle.light"]) statusBarStyle = UIStatusBarStyleLightContent; - else if ([style isEqualToString:@"Brightness.dark"]) + else if ([style isEqualToString:@"SystemUiOverlayStyle.dark"]) statusBarStyle = UIStatusBarStyleDefault; else return;