Skip to content

Commit bb83cc3

Browse files
committed
add checkmark to summary card
1 parent c115b63 commit bb83cc3

File tree

5 files changed

+25
-7
lines changed

5 files changed

+25
-7
lines changed

site/lib/_sass/components/_summary-card.scss

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@
55

66
header {
77
padding: 1rem 1.2rem 1.2rem;
8+
display: flex;
9+
align-items: center;
10+
11+
>div {
12+
flex: 1;
13+
color: var(--site-base-fgColor-alt);
14+
}
815

916
h3 {
1017
margin: 0;
@@ -13,8 +20,8 @@
1320
color: var(--site-base-fgColor);
1421
}
1522

16-
span {
17-
color: var(--site-base-fgColor-alt);
23+
.summary-card-completed {
24+
color: var(--site-alert-tip-color);
1825
}
1926
}
2027

site/lib/src/components/tutorial/summary_card.dart

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,20 @@ class SummaryCardComponent extends StatelessComponent {
4949
Component build(BuildContext context) {
5050
return div(classes: 'summary-card', [
5151
header([
52-
h3([text(model.title)]),
53-
if (model.subtitle case final subtitle?) span([text(subtitle)]),
52+
div([
53+
h3([text(model.title)]),
54+
if (model.subtitle case final subtitle?) span([text(subtitle)]),
55+
]),
56+
if (model.completed)
57+
span(classes: 'summary-card-completed', [
58+
const MaterialIcon('check_circle'),
59+
]),
5460
]),
55-
for (final item in model.items) buildSummaryItem(item),
61+
for (final item in model.items) _buildSummaryItem(item),
5662
]);
5763
}
5864

59-
Component buildSummaryItem(SummaryCardItem item) {
65+
Component _buildSummaryItem(SummaryCardItem item) {
6066
if (item.details case final d?) {
6167
return details([
6268
summary(classes: 'summary-card-item', [

site/lib/src/models/summary_card_model.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,21 @@ class SummaryCardModel {
88
const SummaryCardModel({
99
required this.title,
1010
this.subtitle,
11+
this.completed = false,
1112
required this.items,
1213
});
1314

1415
final String title;
1516
final String? subtitle;
17+
final bool completed;
1618
final List<SummaryCardItem> items;
1719

1820
@decoder
1921
factory SummaryCardModel.fromMap(Map<Object?, Object?> json) {
2022
return SummaryCardModel(
2123
title: json['title'] as String,
2224
subtitle: json['subtitle'] as String?,
25+
completed: json['completed'] as bool? ?? false,
2326
items: (json['items'] as List<Object?>)
2427
.map((e) => SummaryCardItem.fromMap(e as Map<Object?, Object?>))
2528
.toList(),
@@ -30,6 +33,7 @@ class SummaryCardModel {
3033
Map<Object?, Object?> toJson() => {
3134
'title': title,
3235
'subtitle': subtitle,
36+
'completed': completed,
3337
'items': items.map((e) => e.toJson()).toList(),
3438
};
3539
}

site/lib/src/pages/custom_pages.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ items:
194194
<SummaryCard>
195195
title: What you accomplished
196196
subtitle: Here's a summary of what you accomplished in this lesson.
197+
completed: true
197198
items:
198199
- title: Reviewed the core concepts of Flutter
199200
icon: flutter

site/lib/src/style_hash.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
// dart format off
33

44
/// The generated hash of the `main.css` file.
5-
const generatedStylesHash = 'va3Vkb6epp+o';
5+
const generatedStylesHash = 'xVbcnbykNQw/';

0 commit comments

Comments
 (0)