Skip to content

FloatingActionButton always keeps the same position when FloatingActionButtonLocation is top.#64746

Merged
fluttergithubbot merged 8 commits intoflutter:masterfrom
gusghrlrl101:floating_button
Nov 23, 2020
Merged

FloatingActionButton always keeps the same position when FloatingActionButtonLocation is top.#64746
fluttergithubbot merged 8 commits intoflutter:masterfrom
gusghrlrl101:floating_button

Conversation

@gusghrlrl101
Copy link
Contributor

Description

Before

before
When extendBodyBehindAppBar is set false, FloatingActionButton is placed in AppBar.
When extendBodyBehindAppBar is set true, FloatingActionButton is placed in top of the screen.
But when FloatingActionButtonLocation is float or docked, whether it is true or false, it always keeps the same position.
So, I made it always keep the position when FloatingActionButtonLocation is top.

After

after
Whether it is true or false, FloatingActionButtonLocation always keeps the same position.

Related Issues

#63915

Tests

22729f4
20a2357

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.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I signed the CLA.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I updated/added relevant documentation (doc comments with ///).
  • All existing and new tests are passing.
  • The analyzer (flutter analyze --flutter-repo) does not report any problems on my PR.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Did any tests fail when you ran them? Please read Handling breaking changes.

  • No, no existing tests failed, so this is not a breaking change.

@flutter-dashboard flutter-dashboard bot added f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. labels Aug 27, 2020
@rydmike
Copy link
Contributor

rydmike commented Sep 21, 2020

@gusghrlrl101 apparently this has not landed in master yet due to the failed tests?

@gusghrlrl101
Copy link
Contributor Author

@HansMuller
Could you take a look at this please?
It's been hanging on for some time.
Thanks. 😊

@flutter-dashboard
Copy link

This pull request executed golden file tests, but it has not been updated in a while (20+ days). Test results from Gold expire after as many days, so this pull request will need to be updated with a fresh commit in order to get results from Gold.For more guidance, visit Writing a golden file test for package:flutter.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@rydmike
Copy link
Contributor

rydmike commented Nov 16, 2020

Would be nice if this could land at some point as it fixes past faulty behavior. @gusghrlrl101 @HansMuller

@Piinks Piinks self-requested a review November 19, 2020 17:39
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.

Hi @gusghrlrl101 thanks for the contribution. 🎉

extendBodyBehindAppBar: false,
),
));
final Offset center0 = tester.getCenter(find.byType(FloatingActionButton));
Copy link
Contributor

Choose a reason for hiding this comment

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

Just for clarity, can you rename these 'center0' 'center1' to indicate what state they represent? Like 'defaultOffset' & 'extendedBodyOffset'?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Piinks
I renamed center0 and center1 to defaultOffset and extendedBodyOffset.
Thanks for your reply!

Copy link
Contributor

@HansMuller HansMuller left a comment

Choose a reason for hiding this comment

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

This is a nice fix and I apologize that it's taken an eternity to get it reviewed.

If you can add the comment for the one changed line, we'll land it.

bottomSheetSize: bottomSheetSize,
contentBottom: contentBottom,
contentTop: contentTop,
contentTop: appBarHeight,
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks like the correct change however it's a little confusing because the contentTop variable still exists and the ScaffoldPrelayoutGeometry parameter is called contentTop. It would help to add a comment here that briefly explains what's going on.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@HansMuller
I added comment for using appBarHeight instead of contentTop.
Thanks for your reply!

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.

Flutter_LGTM

Thank you for the contribution @gusghrlrl101 !

@BishopSam
Copy link

BishopSam commented Jan 22, 2024

i think we forgot about its brother, extendBody that extends the body of the scaffold behind the bottom navigation bar, this causes fab to go behind the bottom navigation bar

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

Labels

a: quality A truly polished experience 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.

7 participants