From 60e88525a92d03eae61a50532149ca762db45a94 Mon Sep 17 00:00:00 2001 From: Tan Jay Jun Date: Mon, 14 Oct 2019 14:39:49 +0800 Subject: [PATCH] Use iOS 13 dark content status bar style --- .../framework/Source/FlutterPlatformPlugin.mm | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.mm b/shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.mm index 585d5a3879356..44e45d3114649 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.mm @@ -166,17 +166,22 @@ - (void)restoreSystemChromeSystemUIOverlays { } - (void)setSystemChromeSystemUIOverlayStyle:(NSDictionary*)message { - NSString* style = message[@"statusBarBrightness"]; - if (style == (id)[NSNull null]) + NSString* brightness = message[@"statusBarBrightness"]; + if (brightness == (id)[NSNull null]) return; UIStatusBarStyle statusBarStyle; - if ([style isEqualToString:@"Brightness.dark"]) + if ([brightness isEqualToString:@"Brightness.dark"]) { statusBarStyle = UIStatusBarStyleLightContent; - else if ([style isEqualToString:@"Brightness.light"]) - statusBarStyle = UIStatusBarStyleDefault; - else + } else if ([brightness isEqualToString:@"Brightness.light"]) { + if (@available(iOS 13, *)) { + statusBarStyle = UIStatusBarStyleDarkContent; + } else { + statusBarStyle = UIStatusBarStyleDefault; + } + } else { return; + } NSNumber* infoValue = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"UIViewControllerBasedStatusBarAppearance"];