Skip to content

Commit 9f1a525

Browse files
authored
Update widget catalog to show Material 3 widgets (#8574)
Fixes #8432. Site changes are viewable at the staging site: https://flutter-site-73ed1.web.app/development/ui/widgets/. Primary changes: - Addition of Material 3 Components card [(view)](https://flutter-site-73ed1.web.app/development/ui/widgets/). - New Material 3 page showing M3 widgets as displayed in matching categories to material.io/components. This also includes a note about Material 3 becoming the default - this text is not final and can be iterated on in review. - Widget cards in the M3 page have a hover effect applied. - In the widgets overview page, Material now links to M3, and contains a link to the previous M2 widgets page. General notes: - Material 2 page ~~remains unchanged~~ has a notice about Material 3. - No light/dark modes - this was explored but decided against, with the possibility of returning to it if the site undergoes a site-wide dark mode addition. ## Presubmit checklist - [x] This PR doesn’t contain automatically generated corrections (Grammarly or similar). - [x] This PR follows the [Google Developer Documentation Style Guidelines](https://developers.google.com/style) — for example, it doesn’t use _i.e._ or _e.g._, and it avoids _I_ and _we_ (first person). - [x] This PR uses [semantic line breaks](https://github.com/dart-lang/site-shared/blob/master/doc/writing-for-dart-and-flutter-websites.md#semantic-line-breaks) of 80 characters or fewer.
1 parent 38bc248 commit 9f1a525

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+511
-52
lines changed

src/_data/catalog/index.json

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
"id": "basics"
77
},
88
{
9-
"name": "Material Components",
10-
"description": "Visual, behavioral, and motion-rich widgets implementing the <a href=\"https://material.io/design/guidelines-overview\">Material Design guidelines</a>.",
9+
"name": "Material 2 Components",
10+
"description": "Widgets implementing the <a href=\"https://m2.material.io/design\">Material 2 Design guidelines</a>.",
11+
"pagecontent": "Flutter will make Material 3 (M3), the latest version of Material Design, the default in late 2023. Check out our <a href=\"/development/ui/widgets/material/\">M3 widget catalog</a> now.",
1112
"subcategories": [
1213
{
1314
"name": "App structure and navigation"
@@ -28,6 +29,40 @@
2829
"name": "Layout"
2930
}
3031
],
32+
"id": "material2"
33+
},
34+
{
35+
"name": "Material Components",
36+
"description": "Visual, behavioral, and motion-rich widgets implementing the <a href=\"https://m3.material.io/get-started\">Material 3</a> design specification.<br /><br />Material 3 becomes the default Flutter interface in late 2023. To learn more about this transition, check out <a href=\"https://m3.material.io/develop/flutter\">Flutter support for Material 3</a>.",
37+
"pagecontent": "To opt into Material 3, set the <a href=\"https://api.flutter.dev/flutter/material/ThemeData/useMaterial3.html\"><code>useMaterial3</code></a> flag to <code>true</code> in your theme.<br /><br />To catch these widgets in action, check out our live Material 3 <a href=\"https://flutter.github.io/samples/web/material_3_demo\" target=\"_blank\" rel=\"noopener noreferrer\">demo app</a>.<br /><br />You can still check out our legacy <a href=\"/development/ui/widgets/material2\">Material 2 widgets</a> over at their catalog page.",
38+
"subcategories": [
39+
{
40+
"name": "Actions",
41+
"color": "#D9E7CB"
42+
},
43+
{
44+
"name": "Communication",
45+
"color": "#F9DBDA"
46+
},
47+
{
48+
"name": "Containment",
49+
"color": "#F9DBDA"
50+
},
51+
{
52+
"name": "Navigation",
53+
"color": "#E5E4C2"
54+
55+
},
56+
{
57+
"name": "Selection",
58+
"color": "#D9E7CB"
59+
60+
},
61+
{
62+
"name": "Text Inputs",
63+
"color": "#E5E4C2"
64+
}
65+
],
3166
"id": "material"
3267
},
3368
{

src/_data/catalog/widgets.json

Lines changed: 348 additions & 40 deletions
Large diffs are not rendered by default.
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<!-- Material 3 Catalog Page -->
2+
{% for section in site.data.catalog.index %}
3+
{% if section.name == include.category %}
4+
{% assign category = section %}
5+
{% break %}
6+
{% endif %}
7+
{% endfor %}
8+
9+
<div class="catalog">
10+
<div class="category-description">
11+
<p>{{category.description}}</p>
12+
</div>
13+
{% if category.subcategories and category.subcategories.size != 0 -%}
14+
<ul>
15+
{% for sub in category.subcategories -%}
16+
<li><a href="#{{sub.name}}">{{sub.name}}</a></li>
17+
{% endfor -%}
18+
</ul>
19+
{% endif -%}
20+
21+
<p> {{ category.pagecontent }}</p>
22+
23+
{% assign components = site.data.catalog.widgets | where_exp:"comp","comp.categories contains include.category" -%}
24+
25+
{% if category.subcategories and category.subcategories.size != 0 -%}
26+
{% for sub in category.subcategories -%}
27+
{% assign components = site.data.catalog.widgets | where_exp:"comp","comp.subcategories contains sub.name" -%}
28+
{% if components.size != 0 -%}
29+
<h2 id="{{sub.name}}">{{sub.name}}</h2>
30+
<div class="card-deck card-deck--responsive">
31+
{% for comp in components -%}
32+
<div class="card">
33+
<a href="{{comp.link}}">
34+
<div class="card-image-holder-material-3" style="--bg-color: {{sub.color}}">
35+
{{ comp.image }}
36+
<div class="card-image-material-3-hover">
37+
{{ comp.hoverimage }}
38+
</div>
39+
</div>
40+
</a>
41+
<div class="card-body">
42+
<a href="{{comp.link}}"><header class="card-title card-title-material-3">{{comp.name}}</header></a>
43+
<p class="card-text">{{ comp.description | truncatewords: 25 }}</p>
44+
</div>
45+
</div>
46+
{% endfor -%}
47+
</div>
48+
{% endif -%}
49+
{% endfor -%}
50+
{% endif -%}
51+
52+
<p>Check out more widgets in the <a href="{{site.url}}/development/ui/widgets">widget catalog</a>.</p>
53+
</div>

src/_includes/docs/catalogpage.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
</ul>
1818
{% endif -%}
1919

20+
<p>{{ category.pagecontent }}</p>
21+
2022
<p>See more widgets in the <a href="{{site.url}}/development/ui/widgets">widget catalog</a>.</p>
2123

2224
{% assign components = site.data.catalog.widgets | where_exp:"comp","comp.categories contains include.category" -%}

src/_sass/base/_base.scss

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,48 @@ dd {
6363
}
6464
}
6565

66+
.card-title-material-3 {
67+
color: $site-color-body;
68+
}
69+
70+
.card-image-holder-material-3 {
71+
align-items: center;
72+
z-index: -1;
73+
background-size: 0%;
74+
opacity: .999;
75+
background-color: var(--bg-color, white);
76+
77+
img {
78+
max-width: 100%;
79+
max-height: 100%;
80+
width: auto;
81+
z-index: 1;
82+
}
83+
}
84+
85+
.card-image-material-3-hover {
86+
position: absolute;
87+
top: 0;
88+
bottom: 0;
89+
left: 0;
90+
right: 0;
91+
opacity: 0;
92+
transition: .25s ease;
93+
z-index: -1;
94+
95+
img {
96+
max-width: 100%;
97+
max-height: 100%;
98+
width: auto;
99+
z-index: -1;
100+
101+
}
102+
}
103+
104+
.card-image-holder-material-3:hover .card-image-material-3-hover {
105+
opacity: 1;
106+
}
107+
66108
.happy-paths-image-holder {
67109
align-items: left;
68110
display: flex;

src/development/ui/widgets/index.md

Lines changed: 11 additions & 8 deletions

src/development/ui/widgets/material.md

Lines changed: 2 additions & 2 deletions
Lines changed: 16 additions & 0 deletions

0 commit comments

Comments
 (0)