-
Notifications
You must be signed in to change notification settings - Fork 28.9k
AppBar: Use MaterialType.transparency if background color is transpar… #102055
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
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on Discord!). If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). For more information, open the CLA check for this pull request. |
3d51421
to
a45e44c
Compare
This comment was marked as spam.
This comment was marked as spam.
…ent and elevation is zero
a45e44c
to
d973be2
Compare
@goderbauer @HansMuller Please route to a reviewer, this is for internal customer 'june', thanks. |
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 looks OK to me.
@darrenaustin - does this mesh OK with the AppBar changes you're working on?
b3664c0
to
e4f17ce
Compare
PTAL @darrenaustin, thanks. |
Allowing events to pass through the AppBar seems reasonable in this case, although it's likely to be a subtle breaking change for extendBodyBehindAppBar: true apps that have configured their AppBar's backgroundColor and elevation this way. It would probably be better to expose this feature with a new AppBar property, so that apps could opt-in. Maybe expose this feature with hitTestBehavior valued property, like GestureDetector. Default would be HitTestBehavior.opaque. Just FTR: Apparently the reason the setting the AppBar's Material.type to MaterialType.transparency works is that the Material widget's ink splash renderer (_RenderInkFeatures) uses the material type to define the value of hitTestSelf. |
?? _defaultElevation; | ||
// Sets MaterialType to 'transparency' if background color is transparent | ||
// and elevation is zero. | ||
final MaterialType materialType = backgroundColor == const Color(0x00000000) && elevation == 0.0 |
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.
what if the color is something like transparent blue (Colors.blue.withOpacity(0.0) for example)? does flutter/dart:ui already convert it to transparent black or would it be the actual color with 0 alpha/opacity? because if it's the latter then this check would potentially fail
I'm going to close this because #102055 (comment). We should probably enable this feature, assuming that it needs enabling, with a new AppBar flag. |
…ent and elevation is zero
Replace this paragraph with a description of what this PR is changing or adding, and why. Consider including before/after screenshots.
List which issues are fixed by this PR. You must list at least one issue.
#101248
If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].
Pre-launch Checklist
///
).