Skip to content

Conversation

@bleroux
Copy link
Contributor

@bleroux bleroux commented Jul 28, 2023

Description

This PR is a reland of #129274 with a fix and new test related to the revert (#131303).

It updates how a floating snack bar is positionned when a Scaffold defines a FAB with Scaffold.floatingActionButtonLocation sets to one of the top locations.

Before this PR:

  • When a FAB location is set to the top of the Scaffold, a floating SnackBar can't be displayed and an assert throws in debug mode.

After this PR:

  • When a FAB location is set to the top of the Scaffold, a floating SnackBar will be displayed at the bottom of the screen, above a NavigationBar for instance (the top FAB is ignored when computing the floating snack bar position).

image

Motivation

This is a edge case related to a discrepancy between the Material spec and the Flutter Scaffold customizability:

  • Material spec states that a floating SnackBar should be displayed above a FAB. But, in Material spec, FABs are expected to be on the bottom.
  • Since Support New and Custom FAB Locations #51465, Flutter Scaffold makes it valid to show a FAB on the top of the Scaffold.

Related Issue

fixes #128150

Tests

Adds 2 tests.

@github-actions github-actions bot added framework flutter/packages/flutter repository. See also f: labels. f: material design flutter/packages/flutter/material repository. labels Jul 28, 2023
@bleroux bleroux force-pushed the reland_show_floating_snackbar_at_bottom_when_FAB_on_top branch from cad4153 to d4214ff Compare July 28, 2023 12:18
@bleroux bleroux force-pushed the reland_show_floating_snackbar_at_bottom_when_FAB_on_top branch from d4214ff to 4e5c049 Compare July 28, 2023 12:23
@bleroux bleroux requested a review from Piinks July 28, 2023 13:36
Copy link
Contributor

@Piinks Piinks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reland LGTM 👍

@Piinks Piinks added the autosubmit Merge PR when tree becomes green via auto submit App label Jul 28, 2023
@auto-submit auto-submit bot merged commit 7b6af17 into flutter:master Jul 28, 2023
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Jul 29, 2023
flutter/flutter@e81907e...c2b40ca

2023-07-29 [email protected] Roll Flutter Engine from 24ccd8fffbcb to 5184062f7543 (2 revisions) (flutter/flutter#131554)
2023-07-29 [email protected] Roll Flutter Engine from 90bc483524fe to 24ccd8fffbcb (1 revision) (flutter/flutter#131540)
2023-07-29 [email protected] Roll Flutter Engine from 27128f29a066 to 90bc483524fe (2 revisions) (flutter/flutter#131535)
2023-07-29 [email protected] Roll Flutter Engine from 69b5b77edaf7 to 27128f29a066 (1 revision) (flutter/flutter#131533)
2023-07-29 [email protected] Roll Flutter Engine from b854fdea2715 to 69b5b77edaf7 (1 revision) (flutter/flutter#131532)
2023-07-29 [email protected] Roll Flutter Engine from 0a5b2f521539 to b854fdea2715 (1 revision) (flutter/flutter#131530)
2023-07-29 49699333+dependabot[bot]@users.noreply.github.com Bump github/codeql-action from 2.21.0 to 2.21.2 (flutter/flutter#131512)
2023-07-29 [email protected] Roll Flutter Engine from f5c17f0e2406 to 0a5b2f521539 (2 revisions) (flutter/flutter#131529)
2023-07-29 [email protected] Roll Flutter Engine from b4bf592279d6 to f5c17f0e2406 (1 revision) (flutter/flutter#131525)
2023-07-28 [email protected] Roll Flutter Engine from da3721adba65 to b4bf592279d6 (2 revisions) (flutter/flutter#131519)
2023-07-28 [email protected] Roll Flutter Engine from aa1278eb7b84 to da3721adba65 (5 revisions) (flutter/flutter#131514)
2023-07-28 [email protected] Reland - Fix floating SnackBar throws when FAB is on the top (flutter/flutter#131475)
2023-07-28 [email protected] Device discovery output cleanup (flutter/flutter#131223)
2023-07-28 [email protected] Roll Flutter Engine from 182e1189873b to aa1278eb7b84 (2 revisions) (flutter/flutter#131500)
2023-07-28 [email protected] Update `BottomSheet.enableDrag`  & `BottomSheet.showDragHandle` docs for animation controller (flutter/flutter#131484)
2023-07-28 [email protected] Deprecate `useMaterial3` parameter in `ThemeData.copyWith()` (flutter/flutter#131455)
2023-07-28 [email protected] Roll Flutter Engine from 73615d66b2fe to 182e1189873b (2 revisions) (flutter/flutter#131492)
2023-07-28 [email protected] Add `CheckedPopupMenuItemâ��.labelTextStyle` and update default text style for Material 3 (flutter/flutter#131060)
2023-07-28 [email protected] Remove obsolete `complex_layout_ios__compile.dart` test (flutter/flutter#131487)
2023-07-28 [email protected] Roll Flutter Engine from e97014c71014 to 73615d66b2fe (3 revisions) (flutter/flutter#131485)
2023-07-28 [email protected] Shared state to support multi screen inspection  (flutter/flutter#129452)
2023-07-28 [email protected] Roll Packages from f4ae933 to 10aab44 (4 revisions) (flutter/flutter#131483)
2023-07-28 [email protected] Move ios_app_with_extensions_test to host only (flutter/flutter#131441)
2023-07-28 [email protected] Update `Card.color` documentation for Material 3 (flutter/flutter#131468)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
LouiseHsu pushed a commit to LouiseHsu/flutter that referenced this pull request Jul 31, 2023
…#131475)

## Description

This PR is a reland of flutter#129274 with a fix and new test related to the revert (flutter#131303).

It updates how a floating snack bar is positionned when a `Scaffold` defines a FAB with `Scaffold.floatingActionButtonLocation` sets to one of the top locations.

**Before this PR:**
- When a FAB location is set to the top of the `Scaffold`, a floating `SnackBar` can't be displayed and an assert throws in debug mode.

**After this PR:**
- When a FAB location is set to the top of the `Scaffold`, a floating `SnackBar` will be displayed at the bottom of the screen, above a `NavigationBar` for instance (the top FAB is ignored when computing the floating snack bar position).

![image](https://github.com/flutter/flutter/assets/840911/08fcee6c-b286-4749-ad0b-ba09e653bd94)

## Motivation

This is a edge case related to a discrepancy between the Material spec and the Flutter `Scaffold` customizability:
- Material spec states that a floating `SnackBar` should be displayed above a FAB. But, in Material spec, FABs are expected to be on the bottom.
- Since flutter#51465, Flutter `Scaffold` makes it valid to show a FAB on the top of the `Scaffold`.

## Related Issue

fixes flutter#128150

## Tests

Adds 2 tests.
@bleroux bleroux deleted the reland_show_floating_snackbar_at_bottom_when_FAB_on_top branch August 1, 2023 11:29
vashworth pushed a commit to vashworth/flutter that referenced this pull request Aug 2, 2023
…#131475)

## Description

This PR is a reland of flutter#129274 with a fix and new test related to the revert (flutter#131303).

It updates how a floating snack bar is positionned when a `Scaffold` defines a FAB with `Scaffold.floatingActionButtonLocation` sets to one of the top locations.

**Before this PR:**
- When a FAB location is set to the top of the `Scaffold`, a floating `SnackBar` can't be displayed and an assert throws in debug mode.

**After this PR:**
- When a FAB location is set to the top of the `Scaffold`, a floating `SnackBar` will be displayed at the bottom of the screen, above a `NavigationBar` for instance (the top FAB is ignored when computing the floating snack bar position).

![image](https://github.com/flutter/flutter/assets/840911/08fcee6c-b286-4749-ad0b-ba09e653bd94)

## Motivation

This is a edge case related to a discrepancy between the Material spec and the Flutter `Scaffold` customizability:
- Material spec states that a floating `SnackBar` should be displayed above a FAB. But, in Material spec, FABs are expected to be on the bottom.
- Since flutter#51465, Flutter `Scaffold` makes it valid to show a FAB on the top of the `Scaffold`.

## Related Issue

fixes flutter#128150

## Tests

Adds 2 tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Floating SnackBar incompatible with certain FloatingActionButtonLocations

2 participants