Repository navigation
Conversation
498f7b1 to
47f412c
Compare
There was a problem hiding this comment.
Code Review
This pull request refactors the icon system across the repository by replacing the string-based MaterialIcon component with a strongly-typed Icon component that accepts IconData from the generated MaterialSymbols class. This change enables tree-shaking of unused icons, reducing client bundle sizes. The code generator tool has been updated to output these static icon definitions, and tests and components across all sites have been migrated to use the new typed icons. One issue was identified in IconMarkdownComponent where the regular expression pattern for matching the "Icon" tag lacks anchors, which could cause it to incorrectly match other tags containing "icon" as a substring (e.g., <IconButton>).
|
Staged preview of the updated docs.flutter.dev site (updated for commit 50ab7d8): https://flutter-docs-prod--docs-pr14151-feat-tree-shakeable-ic-lhettnlv.web.app |
|
Staged preview of the updated flutter.dev site (updated for commit 50ab7d8): https://flutter-dev-230821--www-pr14151-feat-tree-shakeable-ic-9foyir51.web.app |
48688d1 to
472e13f
Compare
472e13f to
378364f
Compare
378364f to
50ab7d8
Compare
Description of what this PR is changing or adding, and why:
Replaces string-based icon lookups with
static const IconDataproperties onMaterialSymbolsso Dart can tree-shake unused icons from client JS/Wasm bundles:IconDataintopackages/site_shared/lib/src/icon/icon_data.dartandmaterial_symbols_data.dartintopackages/site_shared/lib/src/icon/.dart run dash_site update-iconsto generateMaterialSymbolswithstatic const IconDatafields and aMaterialSymbols.byNamelookup method for dynamic server-side uses.MaterialIcontoIconaccepting anIconDatadirectly, and move Markdown<Icon>tag parsing intoIconMarkdownComponent(CustomComponentBase) so client bundles never referenceMaterialSymbols.byName.site_shared,docs, andwwwto passMaterialSymbols.<name>directly (withMaterialSymbols.byNameused only for dynamic server-side YAML/Markdown data).Issues fixed by this PR (if any):
Fixes #14120
PRs or commits this PR depends on (if any):
Presubmit checklist
of 80 characters or fewer.