Repository navigation
Add support for fill, weight, grade, and optical size to Icon - #106896
Conversation
Icon
| /// The fill for drawing the icon. | ||
| /// | ||
| /// Defaults to the current [IconTheme] color, if any. | ||
| /// Requires the underlying icon font to support the `FILL` [FontVariation] |
There was a problem hiding this comment.
This is a little bit confusing because the developer may not know anything about the default icon font. Can we help them out a little? Here and elsewhere.
There was a problem hiding this comment.
Answered elsewhere. I can point out that font file names often include the supported axes
| /// The color (whether specified explicitly here or obtained from the | ||
| /// [IconTheme]) will be further adjusted by the opacity of the current | ||
| /// [IconTheme], if any. | ||
| /// Can be used to convey a state transition for animation or interaction. |
There was a problem hiding this comment.
Not sure what this means. We support animating an icon's fill property?
There was a problem hiding this comment.
Yes. Material Symbols does it starting from the middle, going in/out a square shape.
| /// Grade and [weight] both affect a symbol's stroke weight (thickness), but | ||
| /// grade has a smaller impact on the size of the symbol. | ||
| /// | ||
| /// Grade is also available in some text fonts. One can match grade levels |
There was a problem hiding this comment.
How does one know if a font supports grade? Similarly, can we make any guarantees about the default text styles (the default Material TextTheme?)
Making sense of this seems particularly difficult for someone who's just reading this bit of API doc. Maybe we could include a link to something that covers the topic in depth?
There was a problem hiding this comment.
There's a convention Google Fonts uses to put the axes in the font file name, it's not obligatory but can help, e.g. MaterialSymbolsOutlined[FILL,GRAD,opsz,wght].ttf. I can't find any docs about it right now.
No guarantees for text yet since this PR concerns only icons. Roboto ⇒ Roboto flex is something to do in the future.
There was a problem hiding this comment.
https://fonts.google.com/knowledge/introducing_type/introducing_variable_fonts might be a good link
darrenaustin
left a comment
There was a problem hiding this comment.
Looks good. Just a question and request for defaults to be documented.
…ter#106896) * wip * update documentation * x * remove trailing spaces * x * remove useless CupertinoIconThemeData copyWith override * add tests * remove trailing spaces * fix isConcrete * x * x * x * remove trailing spaces * tweak docs * mention that font filenames often indicate the supported axes * add back cupertino IconThemeData copyWith * update copyWith
This PR adds framework support required for Material Symbols (design doc, #102560).
Also:
debugFillPropertiesis completedTests
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.