mirror of
https://github.com/flutter/samples.git
synced 2025-11-08 13:58:47 +00:00
update samples_index UX (#371)
- Use Google Sans - add brand colors - adjust spacing on elements - align MDC Chips to spec - update type labels to spec
This commit is contained in:
@@ -33,7 +33,7 @@ String _indexHeader = '''
|
||||
<meta charset="utf-8">
|
||||
<title>Flutter samples</title>
|
||||
<link href="styles.css" rel="stylesheet" media="screen">
|
||||
<link href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700&display=swap" rel="stylesheet">
|
||||
<link href="https://fonts.googleapis.com/css?family=Google+Sans|Google+Sans+Display|Roboto:300,400,500&display=swap" rel="stylesheet">
|
||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<script src="packages/mdc_web/material-components-web.min.js"></script>
|
||||
@@ -46,7 +46,7 @@ String _descriptionHeader = '''
|
||||
<meta charset="utf-8">
|
||||
<title>Flutter samples</title>
|
||||
<link href="styles.css" rel="stylesheet" media="screen">
|
||||
<link href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700&display=swap" rel="stylesheet">
|
||||
<link href="https://fonts.googleapis.com/css?family=Google+Sans|Google+Sans+Display|Roboto:300,400,500&display=swap" rel="stylesheet">
|
||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<script src="packages/mdc_web/material-components-web.min.js"></script>
|
||||
@@ -57,7 +57,7 @@ String _descriptionHeader = '''
|
||||
String _navbar = '''
|
||||
<div class="navbar">
|
||||
<a class="leading" href="./">
|
||||
<img src="images/logos/logo_lockup_flutter_horizontal_wht.png" />
|
||||
<img src="images/logos/logo_lockup_flutter_horizontal_wht_96.png" />
|
||||
<span class="title">Samples</span>
|
||||
</a>
|
||||
<div class="nav-items">
|
||||
@@ -134,7 +134,7 @@ String _backgroundImage(String url) =>
|
||||
_escapeAttribute('background-image: url(\'$url\');');
|
||||
String _indexCards(List<Sample> samples) => samples.map(_indexCard).join();
|
||||
String _indexCard(Sample sample) => '''
|
||||
<div class="mdc-card demo-card mdc-elevation--z2" search-attrs="${_escapeAttribute(sample.searchAttributes)}">
|
||||
<div class="mdc-card demo-card mdc-elevation--z0" search-attrs="${_escapeAttribute(sample.searchAttributes)}">
|
||||
<div class="mdc-card__primary-action demo-card__primary-action" tabindex="0" href="${sample.filename}.html">
|
||||
<div class="mdc-card__media mdc-card__media--16-9 demo-card__media" style="${_backgroundImage(sample.screenshots.first.url)}"></div>
|
||||
<div class="demo-card__label type-label">${_escapeElement(sample.type)}</div>
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 10 KiB |
@@ -1,24 +1,47 @@
|
||||
// Copyright 2020 The Flutter team. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file
|
||||
|
||||
// Flutter brand colors
|
||||
$flutter-grey-900-color: #202124;
|
||||
$flutter-grey-800-color: #3C4043;
|
||||
$flutter-grey-700-color: #5F6368;
|
||||
$flutter-grey-500-color: #5F6368;
|
||||
$flutter-grey-300-color: #DADCE0;
|
||||
$flutter-blue-700-color: #02569B;
|
||||
$flutter-blue-600-color: #0175C2;
|
||||
$flutter-secondary-400-color: #13B9FD;
|
||||
$flutter-yellow: #FFC108;
|
||||
|
||||
// Material Design Web theme colors. Must be imported before importing
|
||||
// material-components-web.scss.
|
||||
$mdc-theme-primary: #0175C2;
|
||||
$mdc-theme-secondary: #FFC108;
|
||||
//$mdc-theme-background: $playground-background-color;
|
||||
//$mdc-theme-surface: $playground-background-color;
|
||||
//$mdc-theme-error: $dark-red;
|
||||
$mdc-theme-primary: $flutter-grey-500-color;
|
||||
$mdc-theme-secondary: $flutter-blue-700-color;
|
||||
|
||||
@import 'package:mdc_web/material-components-web';
|
||||
|
||||
$dark: #202124;
|
||||
// App colors
|
||||
$navbar-background-color: #3D4043;
|
||||
$dark-text-color: #202124;
|
||||
$light-text-color: #3D4043;
|
||||
$background-color: #F8F9FA;
|
||||
$grey: var(--mdc-theme-text-secondary-on-background,rgba(0,0,0,.54));
|
||||
$text-color: $dark-text-color;
|
||||
$card-border-color: #DBDCE0;
|
||||
$type-label-border-color: #82868A;
|
||||
|
||||
// Sizes
|
||||
$font-size-small: 0.875rem;
|
||||
$card-width: 300px;
|
||||
$mobile-width: 960px;
|
||||
$container-width: 960px;
|
||||
$text-color: $dark;
|
||||
$footer-height: 96px;
|
||||
$font: Roboto, sans-serif;
|
||||
|
||||
// Fonts
|
||||
$font: Roboto, sans-serif;
|
||||
$title-font: Google Sans Display, Roboto, sans-serif;
|
||||
$subtitle-font: Google Sans, Roboto, sans-serif;
|
||||
|
||||
// CSS Reset
|
||||
html, body {
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
@@ -29,16 +52,9 @@ body {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.content {
|
||||
min-height: 100%;
|
||||
>.container {
|
||||
padding-bottom: $footer-height;
|
||||
}
|
||||
}
|
||||
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
color: $text-color;
|
||||
font-family: $font;
|
||||
font-family: $title-font;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
@@ -81,13 +97,22 @@ a {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
||||
// Custom Styles
|
||||
.content {
|
||||
min-height: 100%;
|
||||
>.container {
|
||||
padding-bottom: $footer-height;
|
||||
}
|
||||
}
|
||||
|
||||
.navbar {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
||||
background-color: $dark;
|
||||
background-color: $navbar-background-color;
|
||||
color: white;
|
||||
padding: 16px 125px 16px 125px;
|
||||
margin-bottom: 48px;
|
||||
@@ -109,25 +134,27 @@ a {
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
> * {
|
||||
margin: 0 8px 0 8px;
|
||||
margin: 0 8px 3px 8px; // adjusted vertically to align flutter logo text with "Samples" text
|
||||
}
|
||||
}
|
||||
|
||||
.nav-items {
|
||||
font-family: 'Google Sans', 'Roboto', sans-serif;
|
||||
@media screen and (max-width: $mobile-width) {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
span.title {
|
||||
font-size: 28px;
|
||||
font-weight: 300;
|
||||
font-family: 'Google Sans Display', 'Roboto', sans-serif;
|
||||
font-size: 26px;
|
||||
letter-spacing: 0.5px;
|
||||
margin: 0;
|
||||
color: #5DE0FD;
|
||||
color: #13B9FD;
|
||||
}
|
||||
|
||||
img {
|
||||
height: 36px;
|
||||
height: 32px;
|
||||
}
|
||||
|
||||
a {
|
||||
@@ -145,7 +172,7 @@ a {
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
background-color: $dark;
|
||||
background-color: $dark-text-color;
|
||||
color: white;
|
||||
//padding: 36px 125px 36px 125px;
|
||||
height: $footer-height;
|
||||
@@ -186,6 +213,7 @@ a {
|
||||
flex-direction: row;
|
||||
height: 360px;
|
||||
overflow-x: scroll;
|
||||
margin: 48px 0 48px 0;
|
||||
|
||||
@media screen and (max-width: $mobile-width) {
|
||||
height: 240px;
|
||||
@@ -225,6 +253,20 @@ a {
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.mdc-chip {
|
||||
@include mdc-chip-fill-color(transparent);
|
||||
@include mdc-chip-ink-color($flutter-grey-500-color);
|
||||
@include mdc-chip-selected-ink-color($flutter-grey-500-color);
|
||||
}
|
||||
|
||||
.mdc-chip--selected {
|
||||
font-weight: bold;
|
||||
text-decoration: underline;
|
||||
@include mdc-chip-fill-color(transparent);
|
||||
@include mdc-chip-ink-color($flutter-grey-500-color);
|
||||
@include mdc-chip-selected-ink-color($flutter-grey-500-color);
|
||||
}
|
||||
|
||||
.mdc-card__media {
|
||||
background-position: top;
|
||||
}
|
||||
@@ -236,9 +278,10 @@ a {
|
||||
#search-bar {
|
||||
flex: 1;
|
||||
@include mdc-text-field-fill-color($background-color);
|
||||
@include mdc-text-field-line-ripple-color($flutter-blue-600-color);
|
||||
|
||||
@include mdc-states-hover-opacity(0.0);
|
||||
@include mdc-states-focus-opacity(0.0);
|
||||
|
||||
}
|
||||
|
||||
.grid {
|
||||
@@ -253,6 +296,7 @@ a {
|
||||
.demo-card {
|
||||
width: $card-width;
|
||||
margin: 12px;
|
||||
border: 1px solid $card-border-color;
|
||||
@media screen and (max-width: $mobile-width) {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
@@ -263,6 +307,7 @@ a {
|
||||
|
||||
.demo-card__title {
|
||||
font-family: $font;
|
||||
color: $dark-text-color;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
@@ -277,7 +322,7 @@ a {
|
||||
.demo-card__secondary {
|
||||
font-family: $font;
|
||||
padding: 0 1rem 8px;
|
||||
color: $grey;
|
||||
color: $light-text-color;
|
||||
}
|
||||
|
||||
.demo-card__label {
|
||||
@@ -289,8 +334,8 @@ a {
|
||||
.type-label {
|
||||
font-family: $font;
|
||||
font-size: $font-size-small;
|
||||
text-transform: uppercase;
|
||||
color: $dark;
|
||||
text-transform: capitalize;
|
||||
color: $dark-text-color;
|
||||
background-color: rgba(255, 255, 255, .95);
|
||||
border-radius: 8px;
|
||||
padding: 7px;
|
||||
@@ -298,7 +343,11 @@ a {
|
||||
}
|
||||
|
||||
.type-label-bordered {
|
||||
border: 1px solid $dark;
|
||||
color: $type-label-border-color;
|
||||
border: 1px solid $type-label-border-color;
|
||||
background-color: transparent;
|
||||
padding: 4px;
|
||||
font-size: $font-size-small;
|
||||
}
|
||||
|
||||
.description-title-row {
|
||||
@@ -313,33 +362,36 @@ a {
|
||||
.tags-container {
|
||||
max-width: 400px;
|
||||
.tags-label {
|
||||
color: $dark;
|
||||
color: $dark-text-color;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: start;
|
||||
text-transform: uppercase;
|
||||
font-weight: bold;
|
||||
margin-bottom: 6px;
|
||||
>span{
|
||||
margin-left: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
.tags {
|
||||
color: $grey;
|
||||
color: $light-text-color;
|
||||
line-height: 1.6em;
|
||||
|
||||
a {
|
||||
margin-left: 8px;
|
||||
margin-right: 8px;
|
||||
text-decoration: underline;
|
||||
|
||||
color: $dark;
|
||||
color: $flutter-grey-900-color;
|
||||
|
||||
&:active {
|
||||
color: $dark;
|
||||
color: $flutter-grey-900-color;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
color: lighten($dark, 25%);
|
||||
color: lighten($flutter-grey-900-color, 25%);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user