Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
22b5d41
added images and material 3 page
esouthren Apr 11, 2023
54b65f6
Add card and buttons widgets
esouthren Apr 11, 2023
f3e1d6f
add containement widgets
esouthren Apr 11, 2023
5631433
sort file
esouthren Apr 11, 2023
6a8fc19
add navigation widgets
esouthren Apr 11, 2023
acc6d9b
add selection widgets
esouthren Apr 11, 2023
3928ed5
add remaining widgets
esouthren Apr 11, 2023
8f35d3e
update snackbar image
esouthren Apr 11, 2023
a90a624
added material 3 image container
esouthren Apr 12, 2023
6c41f90
added toggle switch
esouthren Apr 13, 2023
f4d4d25
added icon toggle
esouthren Apr 14, 2023
ec5a499
sassy clean
esouthren Apr 14, 2023
69ffd84
added card colors in json
esouthren Apr 14, 2023
a98ec66
update toggle position
esouthren Apr 14, 2023
160533f
update css
esouthren Apr 14, 2023
f21305c
update hover duration and toggle icon boundary
esouthren Apr 14, 2023
e8d001b
update image transparencies
esouthren Apr 18, 2023
3b1ed1d
remove light/dark toggle
esouthren Apr 18, 2023
0deaea6
add other hover images
esouthren Apr 18, 2023
d4b98a8
update formatting
esouthren Apr 18, 2023
13e0075
update copy
esouthren Apr 18, 2023
e2acb2d
code tidy
esouthren Apr 18, 2023
a3fcb39
update listTile link
esouthren Apr 18, 2023
e762d7c
sort json order and whitespace
esouthren Apr 18, 2023
eac578f
comment responses
esouthren Apr 18, 2023
e19107e
Added M2 page notice
esouthren Apr 18, 2023
76eb19f
copy updates
esouthren Apr 19, 2023
897e064
remove m2 card from widgets page
esouthren Apr 19, 2023
66e1757
comment responses
esouthren Apr 20, 2023
644d151
fix other catalog path URLs
esouthren Apr 20, 2023
49f85e6
comment updates
esouthren Apr 20, 2023
2e9d8d9
update buttons Url
esouthren Apr 24, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
added toggle switch
  • Loading branch information
esouthren committed Apr 13, 2023
commit 6c41f9014c307a1a6a8f2899d2adec7dd2c5999e
11 changes: 7 additions & 4 deletions src/_data/catalog/widgets.json
Original file line number Diff line number Diff line change
Expand Up @@ -415,13 +415,15 @@
},
{
"name": "Common Buttons",
"description": "Buttons help people take action, such as sending an email, sharing a document, or liking a comment.",
"description": "<b>Hover for Dark mode</b><br /><br />Buttons help people take action, such as sending an email, sharing a document, or liking a comment.",
"categories": [],
"subcategories": [
"Actions"
],
"link": "https://api.flutter.dev/flutter/material/ButtonStyle-class.html",
"image": "<img alt='' src='/assets/images/docs/widget-catalog/material-3-buttons.png'>"
"image": "/assets/images/docs/widget-catalog/material-3-buttons.png",
"darkimage": "/assets/images/docs/widget-catalog/material-3-buttons-dark.png'>",
"hoverimage": "<img alt='' src='/assets/images/docs/widget-catalog/material-3-buttons-dark.png'>"
},
{
"name": "ConstrainedBox",
Expand Down Expand Up @@ -985,13 +987,14 @@
},
{
"name": "Floating Action Button",
"description": "The FAB represents the most important action on a screen. It puts key actions within reach.",
"description": "<b>Hover for material.io-imagery</b><br /><br />The FAB represents the most important action on a screen. It puts key actions within reach.",
"categories": [],
"subcategories": [
"Actions"
],
"link": "https://api.flutter.dev/flutter/material/FloatingActionButton/FloatingActionButton.html",
"image": "<img alt='' src='/assets/images/docs/widget-catalog/material-3-floating-action-button.png'>"
"image": "<img alt='' src='/assets/images/docs/widget-catalog/material-3-floating-action-button.png'>",
"hoverimage": "<img alt='' src='/assets/images/docs/widget-catalog/material-3-floating-action-button-hover.png'>"
},
{
"name": "FloatingActionButton",
Expand Down
96 changes: 96 additions & 0 deletions src/_includes/docs/catalogpage-material-3.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<script>
var isLightMode = true;

function flipBrightness() {
isLightMode = !isLightMode;
const imgElements = document.getElementsByClassName("m3-img");
console.log(imgElements.length);

// Loop through each img element and replace its src with the appropriate light/dark version.
Array.from(imgElements).forEach((img) => {
const currentSrc = img.getAttribute("src");
const splitSrc = currentSrc.split(".");
const fileExtension = splitSrc.pop();
let fileName = splitSrc.join(".");
const textLabel = document.getElementsByClassName("switch label")[0];

if (!isLightMode) {
fileName += "-dark";
textLabel.innerHTML = 'Tap to view in light mode';
} else {
fileName = fileName.replace("-dark", "");
textLabel.innerHTML = 'Tap to view in dark mode';

}

const newSrc = fileName + "." + fileExtension;
img.setAttribute("src", newSrc);
});
}

</script>

{% for section in site.data.catalog.index %}
{% if section.name == include.category %}
{% assign category = section %}
{% break %}
{% endif %}
{% endfor %}

<div class="catalog">
<div class="category-description">
<p>{{category.description}}</p>
</div>
{% if category.subcategories and category.subcategories.size != 0 -%}
<ul>
{% for sub in category.subcategories -%}
<li><a href="#{{sub.name}}">{{sub.name}}</a></li>
{% endfor -%}
</ul>
{% endif -%}

<p>
See more widgets in the <a href="{{site.url}}/development/ui/widgets">widget catalog</a>.
</p>

<label class="switch">
<input type="checkbox" checked="true" onclick="flipBrightness()">
<span class="slider round"></span>
</label>

<span class="switch label">
Tap to view in dark mode
</span>

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

{% if category.subcategories and category.subcategories.size != 0 -%}
{% for sub in category.subcategories -%}
{% assign components = site.data.catalog.widgets | where_exp:"comp","comp.subcategories contains sub.name" -%}
{% if components.size != 0 -%}
<h2 id="{{sub.name}}">{{sub.name}}</h2>
<div class="card-deck card-deck--responsive">
{% for comp in components -%}
<div class="card">
<a href="{{comp.link}}">
<div class="card-image-holder-material-3">
<img class="m3-img" src="{{ comp.image }}" alt = ''/>
<div class="card-image-material-3-hover">
{{comp.hoverimage}}
</div>
</div>

</a>
<div class="card-body">
<a href="{{comp.link}}"><header class="card-title">{{comp.name}}</header></a>
<p class="card-text">{{ comp.description | truncatewords: 25 }}</p>
</div>
</div>
{% endfor -%}
</div>
{% endif -%}
{% endfor -%}
{% endif -%}

<p>See more widgets in the <a href="{{site.url}}/development/ui/widgets">widget catalog</a>.</p>
</div>
12 changes: 3 additions & 9 deletions src/_includes/docs/catalogpage.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,9 @@ <h2 id="{{sub.name}}">{{sub.name}}</h2>
{% for comp in components -%}
<div class="card">
<a href="{{comp.link}}">
{% if comp.image contains "material-3" -%}
<div class="card-image-holder-material-3">
{{comp.image}}
</div>
{% else -%}
<div class="card-image-holder">
{{comp.image}}
</div>
{% endif -%}
<div class="card-image-holder">
{{comp.image}}
</div>
</a>
<div class="card-body">
<a href="{{comp.link}}"><header class="card-title">{{comp.name}}</header></a>
Expand Down
89 changes: 89 additions & 0 deletions src/_sass/base/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,23 @@ dd {
}
}

.card-image-material-3-hover {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
max-width: 100%;
max-height: 100%;
width: auto;
opacity: 0;
transition: .5s ease;
}

.card-image-holder-material-3:hover .card-image-material-3-hover {
opacity: 1;
}

.happy-paths-image-holder {
align-items: left;
display: flex;
Expand Down Expand Up @@ -218,3 +235,75 @@ blockquote {
text-align: center;
}
}

.switch {
position: relative;
width: 60px;
height: 34px;
}

.switch input {
opacity: 0;
width: 0;
height: 0;
}

.switch.label {
top: 5px;
left: 10px;
position: relative;
}

.switch.container {
display: inline-block;

background-color: red;
}

.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: $site-color-light-grey;
-webkit-transition: .4s;
transition: .4s;
}

.slider:before {
position: absolute;
content: "";
height: 26px;
width: 26px;
left: 4px;
bottom: 4px;
background-color: white;
-webkit-transition: .4s;
transition: .4s;
}

input:checked + .slider {
background-color: $flutter-color-blue-500;
}

input:focus + .slider {
box-shadow: 0 0 1px $flutter-color-blue-500;
}

input:checked + .slider:before {
-webkit-transform: translateX(26px);
-ms-transform: translateX(26px);
transform: translateX(26px);
}

/* Rounded sliders */
.slider.round {
border-radius: 34px;
}

.slider.round:before {
border-radius: 50%;
}

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/development/ui/widgets/material3.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ description: >
A catalog of Flutter's widgets implementing Material 3 design guidelines.
---

{% include docs/catalogpage.html category="Material 3 Components" %}
{% include docs/catalogpage-material-3.html category="Material 3 Components" %}