-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Support New and Custom FAB Locations #51465
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
Conversation
rami-a
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 one possible suggestion
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.
You mentioned in the description that miniCenterTop and miniCenterDocked are not defined since they are just the same as their non-mini versions.
I think it might be more clear if they were defined and just pointed to the same private class, to make the API more consistent. Just a suggestion.
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.
Thank you for the suggestion! I think we can ask Hans about this when he reviews.
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.
solved at flutter/flutter#51465 (20 days ago)
packages/flutter/lib/src/material/floating_action_button_location.dart
Outdated
Show resolved
Hide resolved
packages/flutter/lib/src/material/floating_action_button_location.dart
Outdated
Show resolved
Hide resolved
packages/flutter/test/material/floating_action_button_location_test.dart
Outdated
Show resolved
Hide resolved
HansMuller
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.
Great change; really nice job of factoring. Because we're providing so many FAB location alternative, we're going to need to help developers out by providing more visual documentation than is usual. That extra documentation can be taken care of in a separate PR.
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.
This is a good summary of the class's structure, but it doesn't really explain what it's for. I'd suggest inserting a overview sentence (followed by a blank line of course) like: A base class that simplifies building [FloatingActionButtonLocation]s when used with mixins [FabTopOffsetY] ... just enumerate them all here.
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.
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.
Please use a public FabLocation class for this example
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.
packages/flutter/lib/src/material/floating_action_button_location.dart
Outdated
Show resolved
Hide resolved
packages/flutter/lib/src/material/floating_action_button_location.dart
Outdated
Show resolved
Hide resolved
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.
Just one sentence explaining what this custom location is doing that's special (adjusting the button's horizontal origin ...), would help.
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.
packages/flutter/lib/src/material/floating_action_button_location.dart
Outdated
Show resolved
Hide resolved
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.
All of the mixins refer to an exported FloatingActionButtonLocation, just like this one refers to FloatingActionButtonLocation.startTop. That's good. However for a developer to quickly understand what we mean by "startTop", I think the API docs for the exported locations will need a small screenshot. Something like the ones included in this PR's description. That kind of doc can be added in a separate PR.
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 submitted an issue as a feature request:
#55321
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.
Move the doc above the method here and elsewhere (please review the entire file for this kind of typo/error).
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.
This method has an @override. Should the doc be above the @override or below it?
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.
above the override
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.
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.
This method and the following one could be 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.
a92896f to
f8cb4ef
Compare
HansMuller
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.
Nice job on this one! LGTM
|
Hi! There is an issue with bottom FAB locations in Flutter Web: on Android, the banner that prompts you to install the app hides the FAB button! (I haven't tested the bottom nav bar but that could have an issue as well) |
Description
This PR also adds the following FAB locations, and provides a class
StandardFABLocationand mixins to support user-defined FAB locations.centerTopminiCenterTopminiEndTopstartFloatminiStartFloatminiCenterFloatminiEndFloatstartDockedminiStartDockedminiCenterDockedminiEndDockedThis PR does not implement multiple FAB locations.
There are now 18 predefined FAB locations. Each one is the combination of 3 properties:
All 18 combinations are predefined.
The locations
miniCenterTopandminiCenterDockedare equivalent in effect tocenterTopandcenterDocked, respectively, but they are defined separately.Related Issues
Closes #15122.
Tests
I added the following tests:
FloatingActionButtonLocationis correctly displayed.Screenshots
FloatingActionButtonLocation.endTopFloatingActionButtonLocation.startFloatFloatingActionButtonLocation.miniStartDockedFloatingActionButtonLocation.miniEndFloatFloatingActionButtonLocation.miniCenterFloatA user-defined FAB location, 50 pixels away from

endFloat.A user-defined FAB location, 1/4 the way between

endFloatandstartFloat.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.