Let translucent Cupertino bars have its scaffold children automatically pad their heights#13194
Conversation
…ent nav and tab bars leave behind media query paddings in scaffolds.
a18b8e7 to
4b42a55
Compare
| /// Widget that fits in [CupertinoPageScaffold.navigationBar]. | ||
| /// | ||
| /// Must report its preferred size and whether it's opaque or translucent. | ||
| abstract class BaseCupertinoNavigationBar extends PreferredSizeWidget { |
There was a problem hiding this comment.
It'd be really nice to avoid this. It feels specific enough that I can't think of a great generalised class name. It would be nice to avoid tying it too closely to CupertinoNavigationBar and instead tie it to the underlying behaviour that it represents -- are we completely hiding what's below (in which case padding is applied one way) or not, in which case it's applied another.
|
LGTM for the behaviour -- discussed class naming a bit offline. |
|
Time sensitive, submitting before flutter_tools test on mac finishes. Should be ok. |
|
Last test completed |
| /// The scaffold assumes the nav bar will consume the [MediaQuery] top padding. | ||
| // TODO(xster): document its page transition animation when ready | ||
| final PreferredSizeWidget navigationBar; | ||
| final ObstructingPreferredSizeWidget navigationBar; |
There was a problem hiding this comment.
This is a breaking change, please make sure to announce changes like this on flutter-dev.
| removeTop: true, | ||
| final MediaQueryData existingMediaQuery = MediaQuery.of(context); | ||
|
|
||
| // TODO(https://github.com/flutter/flutter/issues/12912): |
There was a problem hiding this comment.
syntax is TODO(username): message, url
| } | ||
|
|
||
| /// Widget that has a preferred size and reports whether it fully obstructs | ||
| /// widgets behind it. |
There was a problem hiding this comment.
please add a lot more documentation here. imagine someone has never heard of this widget and they want to know why it exists, why to use it, how to use it (both on the implementing side and the consuming side), etc.
| /// | ||
| /// Content can slide under the [tabBar] when it's translucent. | ||
| /// Content can slide under the [tabBar] when it's translucent with a | ||
| /// [MediaQuery] padding hinting the bottom obstructed area. |
| if (widget.tabBar != null) { | ||
| final MediaQueryData existingMediaQuery = MediaQuery.of(context); | ||
|
|
||
| // TODO(https://github.com/flutter/flutter/issues/12912): |
| final EdgeInsets mediaQueryVerticalPadding = | ||
| mediaQuery.padding.copyWith(left: 0.0, right: 0.0); | ||
| // Consume the main axis padding with SliverPadding. | ||
| effectivePadding = scrollDirection == Axis.vertical |
There was a problem hiding this comment.
Doesn't this just throw away the padding the user specified?
There was a problem hiding this comment.
oh, i see, you only do this if padding is null. never mind.
|
Thanks for reviewing. Follow-ups in #13310 |
|
This has been identified as the culprit of test failures for internal Google customers and is blocking an internal roll of Flutter. See bug #70050180 |
|
Reverting. A global non-disable-able auto handling isn't flexible enough. There's a gap now for the list in the gallery's drawer demo. |
…omatically pad their heights (flutter#13194)" This reverts commit 5c4ffa1.
…ly pad their heights (flutter#13194) * Let lists automatically add sliver padding from media query. Translucent nav and tab bars leave behind media query paddings in scaffolds. * tests * const lint * Rename base abstract class to generalized ObstructingPreferredSizeWidget
…ly pad their heights - second try (#13440) * Let translucent Cupertino bars have its scaffold children automatically pad their heights (#13194) * Let lists automatically add sliver padding from media query. Translucent nav and tab bars leave behind media query paddings in scaffolds. * tests * const lint * Rename base abstract class to generalized ObstructingPreferredSizeWidget * review * More docs and comments from #13317
…ly pad their heights (flutter#13194) * Let lists automatically add sliver padding from media query. Translucent nav and tab bars leave behind media query paddings in scaffolds. * tests * const lint * Rename base abstract class to generalized ObstructingPreferredSizeWidget
…omatically pad their heights (flutter#13194)" (flutter#13317) This reverts commit 5c4ffa1.
…ly pad their heights - second try (flutter#13440) * Let translucent Cupertino bars have its scaffold children automatically pad their heights (flutter#13194) * Let lists automatically add sliver padding from media query. Translucent nav and tab bars leave behind media query paddings in scaffolds. * tests * const lint * Rename base abstract class to generalized ObstructingPreferredSizeWidget * review * More docs and comments from flutter#13317
#12913
@cbracken, these are the semantic 'paddings' we talked about. Let me know if you rename them.
Next PR: #12912, use actual layout dimensions instead of self reported dimensions.