From bf740cf46b097bdbc8c5c10ff8842e0a7e1b7452 Mon Sep 17 00:00:00 2001 From: Adam Barth Date: Wed, 22 Jun 2016 07:45:47 -0700 Subject: [PATCH] Restore SystemChrome.setEnabledSystemUIOverlays (#4680) I erroneously removed this function in an earlier patch. Also, export SystemUiOverlayStyle because we expose that enum in the SystemChrome API. --- .../lib/src/services/system_chrome.dart | 32 +++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/packages/flutter/lib/src/services/system_chrome.dart b/packages/flutter/lib/src/services/system_chrome.dart index 97e305c1e08..38441c2f1f6 100644 --- a/packages/flutter/lib/src/services/system_chrome.dart +++ b/packages/flutter/lib/src/services/system_chrome.dart @@ -5,11 +5,13 @@ import 'dart:async'; import 'package:sky_services/flutter/platform/system_chrome.mojom.dart' as mojom; -import 'package:sky_services/flutter/platform/system_chrome.mojom.dart'; +import 'package:sky_services/flutter/platform/system_chrome.mojom.dart' + show DeviceOrientation, SystemUiOverlay, SystemUiOverlayStyle; import 'shell.dart'; -export 'package:sky_services/flutter/platform/system_chrome.mojom.dart' show DeviceOrientation; +export 'package:sky_services/flutter/platform/system_chrome.mojom.dart' + show DeviceOrientation, SystemUiOverlay, SystemUiOverlayStyle; mojom.SystemChromeProxy _initSystemChromeProxy() { return shell.connectToApplicationService('mojo:flutter_platform', mojom.SystemChrome.connectToService); @@ -65,6 +67,32 @@ class SystemChrome { return completer.future; } + /// Specifies the set of overlays visible on the embedder when the + /// application is running. The embedder may choose to ignore unsupported + /// overlays + /// + /// Arguments: + /// + /// * [overlaysMask]: A mask of [SystemUiOverlay] enum values that denotes + /// the overlays to show. + /// + /// Return Value: + /// + /// boolean indicating if the preference was conveyed successfully to the + /// embedder. + /// + /// Platform Specific Notes: + /// + /// If the overlay is unsupported on the platform, enabling or disabling + /// that overlay is a no-op and always return true. + static Future setEnabledSystemUIOverlays(int overlaysMask) { + Completer completer = new Completer(); + _systemChromeProxy.setEnabledSystemUiOverlays(overlaysMask, (bool success) { + completer.complete(success); + }); + return completer.future; + } + /// Specifies the style of the system overlays that are visible on the /// embedder (if any). The embedder may choose to ignore unsupported /// overlays.