Skip to content

Conversation

@chrisbobbe
Copy link
Contributor

Fixes #121752.

With useSafeArea: false, there is no longer a MediaQuery.removePadding with removeTop: true. That MediaQuery was preventing the sheet's content from accurately padding the system intrusion at the top, when desired.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@flutter-dashboard flutter-dashboard bot added f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. labels Mar 8, 2023
Copy link
Member

@gnprice gnprice left a comment

Choose a reason for hiding this comment

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

Thanks! LGTM. (And I see it's essentially the same as the remaining part of #121588 after #122118 was merged.)

We found on #121588 that these changes caused failures in Google testing. I believe this is nevertheless the right change, for the reasons at #121752 (comment) and in the thread up to #121588 (comment) . But I'd like to have @Hangyujin's input on what's going on in those tests — whether the code in question is just working around broken behavior and can be updated to work with the fixed behavior, or whether perhaps there's something we've missed that makes the existing behavior the right way after all.

@gnprice gnprice requested a review from hannah-hyj March 8, 2023 23:04
@gnprice
Copy link
Member

gnprice commented Mar 20, 2023

@Hangyujin Do you think you might be able to take a look at the Google tests affected by this fix? I see your major bottom-sheet PR #122445 has now been merged :-)

@hannah-hyj
Copy link
Member

@chrisbobbe Hi Can you rebase this PR to re-trigger google testing? I can't see the failure details for it.

@gnprice gnprice force-pushed the pr-bottom-sheet-allow-pad-top-notch branch from ae9992d to 9fd44ea Compare March 20, 2023 18:12
@chrisbobbe
Copy link
Contributor Author

Ah it looks like @gnprice has just done so; thanks, Greg!

@gnprice
Copy link
Member

gnprice commented Mar 22, 2023

@Hangyujin Are you able to see failure details for the PR now?

The reporting of status back to GitHub seems to be getting stuck, but I'm told in #hackers-infra that it ran and there are some failures visible from inside Google.

@hannah-hyj
Copy link
Member

Talked to a release team member, and he suggested me to try give this an approval to see if it can trigger google testing to start.

@gnprice
Copy link
Member

gnprice commented Mar 24, 2023

Looks like it's still in status pending.

I think the release team member's suggestion may have been about this point:

Google Testing does not start until a Flutter hacker has approved the PR.

But the PR already satisfied that condition, since I'd approved it earlier. So if it's about that condition, then a second approval wouldn't change things.

I'll try updating the branch again. Perhaps on a third roll of the dice, things will work. (Also, perhaps the underlying issue is about the infra running into GitHub rate limits, in which case this might be a less congested time of day.)

Fixes flutter#121752.

With `useSafeArea: false`, there is no longer a
`MediaQuery.removePadding` with `removeTop: true`. That `MediaQuery`
was preventing the sheet's content from accurately padding the
system intrusion at the top, when desired.
@gnprice gnprice force-pushed the pr-bottom-sheet-allow-pad-top-notch branch from 6f231cc to 93f6de4 Compare March 24, 2023 06:03
@gnprice
Copy link
Member

gnprice commented Mar 24, 2023

🎉 Google testing reported results! Failures, as expected.

@Hangyujin when you get a chance, it would be great if you can take a look at what's going on in those tests — whether the code in question is just working around broken behavior and can be updated to work with the fixed behavior, or whether perhaps there's something we've missed that makes the existing behavior the right way after all.

(There are also failures in customer_testing, but those are unrelated to the PR: #123385.)

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

@chrisbobbe
Copy link
Contributor Author

Just updated with a merge commit.

@chrisbobbe
Copy link
Contributor Author

Just updated again.

@chrisbobbe
Copy link
Contributor Author

Updated.

@chrisbobbe
Copy link
Contributor Author

Hmm, an automated check failed: "Pull Request Labeler / triage (pull_request_target)".

Clicking through to see details, there are some error lines in the output:

[…]
Error: Error: found unexpected type for label 'a: accessibility' (should be array of config options)
Error: found unexpected type for label 'a: accessibility' (should be array of config options)
[…]

Neither this PR nor its linked issue (#121752) are labeled with 'a: accessibility'…hmm.

Ah! Those errors are mentioned in #129666, which has been closed as fixed. I'll make another merge commit to update this, and see if that fixes it.

@Hixie
Copy link
Contributor

Hixie commented Aug 22, 2023

@chrisbobbe thanks for the contribution! Sorry for the delay in reviewing the test results.

I just triggered an update so that the bots would run again. Can you ping us on Discord when the tests give a result so that someone can help you find out what is going on? Thanks!

@Hixie
Copy link
Contributor

Hixie commented Aug 23, 2023

Google testing failures: looks like it's caused a bunch of apps to have some additional padding at the top of bottom sheets.

@chrisbobbe
Copy link
Contributor Author

chrisbobbe commented Aug 23, 2023

Makes sense; I would expect that to happen in most cases where the bottom-sheet content has a SafeArea with top: true. Each case should be described by one of these three scenarios:

  1. The bottom-sheet content doesn't want to pad the top inset. It makes the mistake of building a SafeArea with top: true and should stop doing that.
  2. The bottom-sheet content wants to pad the top inset, and it wasn't doing so before. The SafeArea with top: true has started to work as intended. (Nothing to change.)
  3. The bottom-sheet content wants to pad the top inset, and it was doing so before: whether to a wrong, hardcoded value, or to the right value because of hacking around the removeTop. The content includes a SafeArea with top: true, which used to be a no-op but now adds padding on top of the hack. The hack should be removed, leaving behind a normal use of SafeArea with top: true.

If that's wrong, perhaps there's something we've missed that makes the existing behavior the right way after all. 🙂

@Hixie
Copy link
Contributor

Hixie commented Aug 23, 2023

The problem is that this would essentially introduce a silent regression which we could not detect or automation migration for. So we'd essentially be breaking shipping apps without any way for the developer to notice unless they tested every screen on a lot of devices (with different notches), which is more effort than many people can afford.

@chrisbobbe
Copy link
Contributor Author

chrisbobbe commented Aug 23, 2023

I see. I think one way forward would be:

  • Close as WONTFIX ModalBottomSheetRoute: Content can't consume top notch with SafeArea #121752.
  • Document the current behavior: with useSafeArea: false, if you put a SafeArea in the content, it won't have top padding. That's actually also true of useSafeArea: true, but that's not surprising, because in that case the top edge of the sheet can't actually enter the device's top inset.

Thinking more about this with @gnprice, we don't really understand the use case for useSafeArea: false, which is where #121752 is active. The default is false.

(why we don't understand that use case)

#39205 (comment) mentions one bottom sheet that builds a whole Scaffold with an app bar that "docks" at the top of the screen, and so it mustn't be prevented from entering the top inset, as true would do. I don't know which app that is, or whether it still does it that way. In that app, it's not clear to me whether you'd want top padding or not:

  • With padding, won't it look wrong when the sheet is open halfway?
  • Without padding, won't it look wrong when the sheet is open fully ("docked" at the top)?
  • With dynamic padding computed from the top edge's position, won't that break the Material metaphor?

Possibly, useSafeArea: true should have been the default, but changing that default also sounds disruptive and breaking. But as I said at the top of this comment, some more documentation could be helpful.

@Hixie
Copy link
Contributor

Hixie commented Aug 23, 2023

Documentation is always welcome, certainly. And I agree that it's not clear that we made the right choices when initially developing this, unfortunately.

@chrisbobbe
Copy link
Contributor Author

Makes sense. I just sent #134793 for that documentation, and so now I'll close this PR, and close #121752 as WONTFIX (after commenting there to refer to #134793).

@chrisbobbe chrisbobbe closed this Sep 15, 2023
chrisbobbe added a commit to chrisbobbe/flutter that referenced this pull request Oct 6, 2023
auto-submit bot pushed a commit that referenced this pull request Oct 7, 2023
…134793)

As discussed at #122225 (comment), this is a docs change meant to help people in the absence of a fix for #121752, which is being closed as WONTFIX.
Mairramer pushed a commit to Mairramer/flutter that referenced this pull request Oct 10, 2023
…lutter#134793)

As discussed at flutter#122225 (comment), this is a docs change meant to help people in the absence of a fix for flutter#121752, which is being closed as WONTFIX.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

ModalBottomSheetRoute: Content can't consume top notch with SafeArea

4 participants