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
Add support for Material 3 medium and large top app bars. #103962
Add support for Material 3 medium and large top app bars. #103962
Conversation
f0d1ae1
to
bb5fe05
Compare
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, love the screen recordings. It's unfortunate to have to redefine long argument lists to modify a few defaults. Could this be improved by collapsing the two factory constructors into one, with an additional parameter specifying the size?
I thought about it, but the naming would get a bit weird (i.e. what is the name of the new single factory constructor? Having two constructors definitely has duplication in the parameter lists, but seems like the most straightforward and easy to use API. If people feel strongly about this, I can certainly take a stab at combining them. |
bb5fe05
to
ae70672
Compare
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.
Can we add Dartpad(s) like #102823?
Ignore me, just saw them :)
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.
@darrenaustin this is awesome!
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, just some trivial feedback.
It would be user friendly if the scaffold API incorporated those without having to pass through a CustomScrollView. |
ae70672
to
0846d04
Compare
It would be nice, but I am not sure how we could do that. The requirements for this scrolling effect are complicated enough that we need the flexibility of slivers, which requires the CustomScrollView. The Scaffold doesn't really participate in scrolling directly so I am not sure how we could better integrate these APIs. @Piinks do you have any thoughts on this? |
I am not sure what you mean @cedvdb, can you elaborate? A SliverAppBar can only be used in a CustomScrollView, and I am not sure what you mean by passing through it. The Scaffold is not aware of its contents, including the presence of a CustomScrollView. The Scaffold is already a pretty heavily loaded widget, and adding more API surface and complexity to it is likely something we would want to avoid doing. |
I meant to have a SliverScaffold of some sort with factories. Imo, scenarios from the official specs could be covered as not need any |
…3962) * Add support for M3 AppBar 'Medium' and 'Large' types. * Updates from review feedback. * Updated from review feedback.
@darrenaustin @cedvdb @Piinks @HansMuller They now do this: @override
TextStyle? get collapsedTextStyle =>
_textTheme.titleLarge?.apply(color: _colors.onSurface);
@override
TextStyle? get expandedTextStyle =>
_textTheme.headlineSmall?.apply(color: _colors.onSurface); I would expect them to fall through via If I for example make an Plus for it to work with Material 2 mode color defaults, it would need to replicate the standard un-themed EDIT: If things reported in this comment are seen as something that should be fixed, and not a "feature", I can open it as an issue report as well. |
@darrenaustin - #103962 (comment) looks like it covers some legitimate bugs in the new variants; please file issues |
@HansMuller and @darrenaustin for info, I opened an issue for it here: #110951 |
A follow on to #101884.
This adds support for the new Material 3 'Medium' and 'Large' type app bars.
Two new factory methods for
SliverAppBar
have been added:SliverAppBar.medium
andSliverAppBar.large
. These can be used inside aCustomScrollView
like otherSliverAppBar
s, but will be configured for the 'Medium' or 'Large' defaults and behaviour.Here is an example of how to create a 'Medium' app bar:
Fixes: #102684.
Pre-launch Checklist
///
).