From fc7ce3eeb6ce7038042a711f6c32ebf5b2dfbaa5 Mon Sep 17 00:00:00 2001 From: Shi-Hao Hong Date: Fri, 17 Apr 2020 16:58:25 -0700 Subject: [PATCH] Step 3: Removes temporary flag for SnackBarBehavior.floating offset fix (#55064) * Remove SnackBar floating flag, making the offset fix the only behavior * Remove rest of code that contians references to Scaffold.shouldSnackBarIgnoreFABRect --- .../flutter/lib/src/material/scaffold.dart | 26 +++---------------- .../flutter/test/material/snack_bar_test.dart | 4 --- 2 files changed, 3 insertions(+), 27 deletions(-) diff --git a/packages/flutter/lib/src/material/scaffold.dart b/packages/flutter/lib/src/material/scaffold.dart index 7bf184fe3ad..86bdd734a4c 100644 --- a/packages/flutter/lib/src/material/scaffold.dart +++ b/packages/flutter/lib/src/material/scaffold.dart @@ -2,10 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// TODO(shihaohong): remove ignoring deprecated member use analysis -// when Scaffold.shouldSnackBarIgnoreFABRect parameter is removed. -// ignore_for_file: deprecated_member_use_from_same_package - import 'dart:async'; import 'dart:collection'; import 'dart:math' as math; @@ -556,15 +552,10 @@ class _ScaffoldLayout extends MultiChildLayoutDelegate { } double snackBarYOffsetBase; - if (Scaffold.shouldSnackBarIgnoreFABRect) { - if (floatingActionButtonRect.size != Size.zero && isSnackBarFloating) - snackBarYOffsetBase = floatingActionButtonRect.top; - else - snackBarYOffsetBase = contentBottom; + if (floatingActionButtonRect.size != Size.zero && isSnackBarFloating) { + snackBarYOffsetBase = floatingActionButtonRect.top; } else { - snackBarYOffsetBase = floatingActionButtonRect != null && isSnackBarFloating - ? floatingActionButtonRect.top - : contentBottom; + snackBarYOffsetBase = contentBottom; } positionChild(_ScaffoldSlot.snackBar, Offset(0.0, snackBarYOffsetBase - snackBarSize.height)); @@ -1334,17 +1325,6 @@ class Scaffold extends StatefulWidget { /// By default, the drag gesture is enabled. final bool endDrawerEnableOpenDragGesture; - /// This flag is deprecated and fixes and issue with incorrect clipping - /// and positioning of the [SnackBar] set to [SnackBarBehavior.floating]. - @Deprecated( - 'This property controls whether to clip and position the snackbar as ' - 'if there is always a floating action button, even if one is not present. ' - 'It exists to provide backwards compatibility to ease migrations, and will ' - 'eventually be removed. ' - 'This feature was deprecated after v1.15.3.' - ) - static bool shouldSnackBarIgnoreFABRect = true; - /// The state from the closest instance of this class that encloses the given context. /// /// {@tool dartpad --template=freeform} diff --git a/packages/flutter/test/material/snack_bar_test.dart b/packages/flutter/test/material/snack_bar_test.dart index 67b7b27c015..f3889286d35 100644 --- a/packages/flutter/test/material/snack_bar_test.dart +++ b/packages/flutter/test/material/snack_bar_test.dart @@ -2,10 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// TODO(shihaohong): remove ignoring deprecated member use analysis -// when Scaffold.shouldSnackBarIgnoreFABRect parameter is removed. -// ignore_for_file: deprecated_member_use_from_same_package - import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_test/flutter_test.dart';