From 9a7b1a73bdb7d885ed04b471c7f26656e0d196b8 Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Wed, 16 Jan 2019 10:31:44 -0800 Subject: [PATCH] Replace platform check with swtich (#24752) Generally, we should always use default-less switches for platform-specific behaviour so we're forced to make a conscious decision on each instance of such behaviour any time we add support for a new platform. --- .../flutter/lib/src/material/scaffold.dart | 35 +++++++++++-------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/packages/flutter/lib/src/material/scaffold.dart b/packages/flutter/lib/src/material/scaffold.dart index 8ced976edf..401d861a32 100644 --- a/packages/flutter/lib/src/material/scaffold.dart +++ b/packages/flutter/lib/src/material/scaffold.dart @@ -1777,21 +1777,26 @@ class ScaffoldState extends State with TickerProviderStateMixin { removeBottomPadding: true, ); - if (themeData.platform == TargetPlatform.iOS) { - _addIfNonNull( - children, - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: _handleStatusBarTap, - // iOS accessibility automatically adds scroll-to-top to the clock in the status bar - excludeFromSemantics: true, - ), - _ScaffoldSlot.statusBar, - removeLeftPadding: false, - removeTopPadding: true, - removeRightPadding: false, - removeBottomPadding: true, - ); + switch (themeData.platform) { + case TargetPlatform.iOS: + _addIfNonNull( + children, + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: _handleStatusBarTap, + // iOS accessibility automatically adds scroll-to-top to the clock in the status bar + excludeFromSemantics: true, + ), + _ScaffoldSlot.statusBar, + removeLeftPadding: false, + removeTopPadding: true, + removeRightPadding: false, + removeBottomPadding: true, + ); + break; + case TargetPlatform.android: + case TargetPlatform.fuchsia: + break; } if (_endDrawerOpened) {