-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Step 1: SnackBarBehavior.floating offset fix - Soft breaking change #50597
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Step 1: SnackBarBehavior.floating offset fix - Soft breaking change #50597
Conversation
Now the test checks certain position Y of FAB
added tests for testing height of SnackBar.
…n' to group 'SnackBar position' improved test by removing padding details, and renaming.
… group "SnackBar position" and improved test for testing with universal behavior
|
cc/ @filaps If you're okay with these changes, could you consent to the CLA? Please feel free to make any suggestions to the PR if you have any as well |
|
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
| 'is present when it is not. This parameter will be removed. ' | ||
| 'This feature was deprecated after v1.15.3.' | ||
| ) | ||
| final bool shouldSnackBarIgnoreFABRect; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit - why not just make this static?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How would that work? Would all Flutter apps then simply set Scaffold.shouldSnackBarIgnoreFABRect = true before they call runApp?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right. It's not something we expect people to want to use, let alone to use differently for different scaffolds.
Presumably they could even set it after runApp, but they should probably do it before any builds kick off to avoid weirdness.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
| /// This flag is deprecated and fixes and issue with incorrect clipping | ||
| /// and positioning of the [SnackBar] set to [SnackBarBehavior.floating]. | ||
| @Deprecated( | ||
| 'Fixes a bug that that fixes clipping and positioning of SnackBar ' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
| 'Fixes a bug that that fixes clipping and positioning of SnackBar ' | |
| 'Fixes a bug that fixes clipping and positioning of SnackBar ' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realized the wording in general was off, so I changed it to the following if that's okay:
'Fixes a bug that incorrectly clips and positions SnackBar. It '
'previously incorrectly offsets itself assuming a floating action button '
'is present even when it is not. This parameter will be removed. '
'This feature was deprecated after v1.15.3.'
|
@googlebot I consent. |
|
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
|
LGTM. |
| @required this.isSnackBarFloating, | ||
| @required this.extendBody, | ||
| @required this.extendBodyBehindAppBar, | ||
| @required this.shouldSnackBarIgnoreFABRect, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's ditch this and just acccess the static property.
| 'Fixes a bug that incorrectly clips and positions SnackBar. It ' | ||
| 'previously incorrectly offsets itself assuming a floating action button ' | ||
| 'is present even when it is not. This parameter will be removed. ' | ||
| 'This feature was deprecated after v1.15.3.' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: maybe something like:
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.
dnfield
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with some nits
Description
Relands #47616, but as an opt-in change to allow developers to migrate to the fixed version. The original PR caused golden tests to fail since the
SnackBar's offset was updated.Screenshots
Before fix
After fix
Migration guide
Scaffold.shouldSnackBarIgnoreFABRecttotrueafter this PR is merged.a) Fix all golden tests to expect the new change.
b) Fix any widget tests that expect the SnackBar to appear higher than it should. The difference should simply be the size of the floating action button's rect.
Scaffold.shouldSnackBarIgnoreFABRectis set to true by default (in a subsequent PR), remove the parameter from all instances ofScaffold.Related Issues
Addresses #47202
Addresses #43716
Tests
I added the following tests:
shouldSnackBarIgnoreFABRectflag turned on.Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]). This will ensure a smooth and quick review process.///).flutter analyze --flutter-repo) does not report any problems on my PR.Breaking Change
Did any tests fail when you ran them? Please read Handling breaking changes.