Skip to content

Commit 54f2e62

Browse files
committed
[102] Completed code.
[101] Making AppBar something you add in 102. [Model] Adding model from the start. [103] Adding fonts. [103] Supplemental files. [101] Correcting supplemental files. [101] Copy correction. [101] Minor renaming. [101] Update for Dart 2. [101] Missing dependency. [101] Dart 2. [101] Dart 2. [101] Dart 2. [101] Dart 2. [101] Correcting model. [Meta] README file. [Meta] Clarification. [101] Copy correction. [104] Updating data. [101] Correcting widget class. (#23) Add link to actual codelab in the README [Meta] README correction. [101] README specificity. Add the slanted_menu.png to assets for 101 branch so its ready when needed. (#44) [101] TODOs for starter code (#50) [101] Added future TODOs to 101 starter [101] Included lines to ignore .iml files and files in idea/ (#67) [101] Completed code. [101] Making AppBar something you add in 102. [Model] Adding model from the start. [103] Adding fonts. [103] Supplemental files. [101] Correcting supplemental files. [101] Copy correction. [101] Minor renaming. [101] Update for Dart 2. [101] Missing dependency. [101] Dart 2. [101] Dart 2. [101] Dart 2. [101] Dart 2. [101] Correcting model. [Meta] README file. [Meta] Clarification. [101] Copy correction. [104] Updating data. [101] Correcting widget class. (#23) Add link to actual codelab in the README [Meta] README correction. [101] README specificity. Add the slanted_menu.png to assets for 101 branch so its ready when needed. (#44) [101] TODOs for starter code (#50) [101] Added future TODOs to 101 starter [101] Completed Code. [101] Making AppBar something you add in 102. [Model] Adding model from the start. [103] Adding fonts. [103] Supplemental files. [101] Correcting supplemental files. [101] Copy correction. [101] Minor renaming. [101] Update for Dart 2. [101] Missing dependency. [101] Dart 2. [101] Dart 2. [101] Dart 2. [101] Dart 2. [101] Correcting model. [Meta] README file. [Meta] Clarification. [101] Copy correction. [104] Updating data. [101] Correcting widget class. (#23) Add link to actual codelab in the README [Meta] README correction. [101] README specificity. Add the slanted_menu.png to assets for 101 branch so its ready when needed. (#44) [101] TODOs for starter code (#50) [101] Added future TODOs to 101 starter (#59) [101] Completed code. [101] Making AppBar something you add in 102. [Model] Adding model from the start. [103] Adding fonts. [103] Supplemental files. [101] Correcting supplemental files. [101] Copy correction. [101] Minor renaming. [101] Update for Dart 2. [101] Missing dependency. [101] Dart 2. [101] Dart 2. [101] Dart 2. [101] Dart 2. [101] Correcting model. [Meta] README file. [Meta] Clarification. [101] Copy correction. [104] Updating data. [101] Correcting widget class. (#23) Add link to actual codelab in the README [Meta] README correction. [101] README specificity. Add the slanted_menu.png to assets for 101 branch so its ready when needed. (#44) [101] TODOs for starter code (#50) [102] Completed code. [101] Starter code. [103] Supplemental files. [101] Correcting supplemental files. [101] Minor renaming. [101] Missing dependency. [101] Dart 2. [101] Dart 2. [101] Complete code. [102] Starter code. [102] Minor copy correction. [101] Update for Dart 2 [102] Rebase. [102] starter todos (#54) [102] Completed code. [101] Making AppBar something you add in 102. [Model] Adding model from the start. [103] Adding fonts. [103] Supplemental files. [101] Correcting supplemental files. [101] Copy correction. [101] Minor renaming. [101] Update for Dart 2. [101] Missing dependency. [101] Dart 2. [101] Dart 2. [101] Dart 2. [101] Dart 2. [101] Correcting model. [Meta] README file. [Meta] Clarification. [101] Copy correction. [104] Updating data. [101] Correcting widget class. (#23) Add link to actual codelab in the README [Meta] README correction. [101] README specificity. Add the slanted_menu.png to assets for 101 branch so its ready when needed. (#44) [101] TODOs for starter code (#50) [101] Added future TODOs to 101 starter [101] Completed Code. [101] Making AppBar something you add in 102. [Model] Adding model from the start. [103] Adding fonts. [103] Supplemental files. [101] Correcting supplemental files. [101] Copy correction. [101] Minor renaming. [101] Update for Dart 2. [101] Missing dependency. [101] Dart 2. [101] Dart 2. [101] Dart 2. [101] Dart 2. [101] Correcting model. [Meta] README file. [Meta] Clarification. [101] Copy correction. [104] Updating data. [101] Correcting widget class. (#23) Add link to actual codelab in the README [Meta] README correction. [101] README specificity. Add the slanted_menu.png to assets for 101 branch so its ready when needed. (#44) [101] TODOs for starter code (#50) [101] Added future TODOs to 101 starter (#59) [101] Completed code. [101] Making AppBar something you add in 102. [Model] Adding model from the start. [103] Adding fonts. [103] Supplemental files. [101] Correcting supplemental files. [101] Copy correction. [101] Minor renaming. [101] Update for Dart 2. [101] Missing dependency. [101] Dart 2. [101] Dart 2. [101] Dart 2. [101] Dart 2. [101] Correcting model. [Meta] README file. [Meta] Clarification. [101] Copy correction. [104] Updating data. [101] Correcting widget class. (#23) Add link to actual codelab in the README [Meta] README correction. [101] README specificity. Add the slanted_menu.png to assets for 101 branch so its ready when needed. (#44) [101] TODOs for starter code (#50) [102] Completed code. [101] Starter code. [103] Supplemental files. [101] Correcting supplemental files. [101] Minor renaming. [101] Missing dependency. [101] Dart 2. [101] Dart 2. [101] Complete code. [102] Starter code. [102] Minor copy correction. [101] Update for Dart 2 [102] Rebase. [102] starter todos (#54) [102] Completed code. [101] Making AppBar something you add in 102. [Model] Adding model from the start. [103] Adding fonts. [103] Supplemental files. [101] Correcting supplemental files. [101] Copy correction. [101] Minor renaming. [101] Update for Dart 2. [101] Missing dependency. [101] Dart 2. [101] Dart 2. [101] Dart 2. [101] Dart 2. [101] Correcting model. [Meta] README file. [Meta] Clarification. [101] Copy correction. [104] Updating data. [101] Correcting widget class. (#23) Add link to actual codelab in the README [Meta] README correction. [101] README specificity. Add the slanted_menu.png to assets for 101 branch so its ready when needed. (#44) [101] TODOs for starter code (#50) [101] Added future TODOs to 101 starter [102] Completed code. [101] Starter code. [103] Supplemental files. [101] Correcting supplemental files. [101] Minor renaming. [101] Missing dependency. [101] Dart 2. [101] Dart 2. [101] Complete code. [102] Starter code. [102] Minor copy correction. [101] Update for Dart 2 [102] Rebase. [102] starter todos (#54) [102] Completed code. [101] Starter code. [103] Supplemental files. [101] Correcting supplemental files. [101] Minor renaming. [101] Missing dependency. [101] Dart 2. [101] Dart 2. [101] Complete code. [102] Starter code. [102] Minor copy correction. [101] Update for Dart 2 [102] Rebase. [102] starter todos (#54) [102] Completed code. [101] Starter code. [101] Making AppBar something you add in 102. [Model] Adding model from the start. [103] Adding fonts. [103] Supplemental files. [101] Correcting supplemental files. [101] Copy correction. [101] Minor renaming. [101] Update for Dart 2. [101] Missing dependency. [101] Dart 2. [101] Dart 2. [101] Dart 2. [101] Dart 2. [101] Correcting model. [Meta] README file. [Meta] Clarification. [101] Copy correction. [104] Updating data. [101] Correcting widget class. (#23) Add link to actual codelab in the README [Meta] README correction. [101] README specificity. [101] Complete code. [102] Starter code. [102] Minor copy correction. [101] Update for Dart 2 [102] Rebase. Add the slanted_menu.png to assets for 101 branch so its ready when needed. (#44) (#45) [102] Complete code. [103] Starter code. [102] Correcting home being stateful. [103] Correcting order of fields. (#10) [102] Removing unneeded value. [102] Dart 2. [102] Data correction. [103] README specificity. [META] Readme correction. [103] Remove confusing comments.
1 parent 4244035 commit 54f2e62

File tree

4 files changed

+95
-7
lines changed

4 files changed

+95
-7
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Codelabs MDC-101 through MDC-104 will guide you through building and integrating
1111
The starter and completed code is in the various branches of this repo.
1212

1313
## Getting Started
14-
Visit the [Google codelabs site](https://codelabs.developers.google.com/), or [codelabs.developers.google.com/codelabs/mdc-102-flutter](https://codelabs.developers.google.com/codelabs/mdc-102-flutter), to follow along the guided steps.
14+
Visit the [Google codelabs site](https://codelabs.developers.google.com/), or [codelabs.developers.google.com/codelabs/mdc-103-flutter](https://codelabs.developers.google.com/codelabs/mdc-103-flutter), to follow along the guided steps.
1515

1616
## Support
1717

mdc_100_series/lib/app.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import 'login.dart';
1919

2020
// TODO: Convert ShrineApp to stateful widget (104)
2121
class ShrineApp extends StatelessWidget {
22-
22+
2323
@override
2424
Widget build(BuildContext context) {
2525
return MaterialApp(

mdc_100_series/lib/home.dart

+90-5
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,107 @@
1313
// limitations under the License.
1414

1515
import 'package:flutter/material.dart';
16+
import 'package:intl/intl.dart';
17+
18+
import 'model/data.dart';
19+
import 'model/product.dart';
1620

1721
class HomePage extends StatelessWidget {
18-
// TODO: Make a collection of cards (102)
1922
// TODO: Add a variable for Category (104)
2023

24+
List<Card> _buildGridCards(BuildContext context) {
25+
List<Product> products = getProducts(Category.all);
26+
27+
if (products == null || products.isEmpty) {
28+
return const <Card>[];
29+
}
30+
31+
final ThemeData theme = Theme.of(context);
32+
final NumberFormat formatter = NumberFormat.simpleCurrency(
33+
locale: Localizations.localeOf(context).toString());
34+
35+
return products.map((product) {
36+
return Card(
37+
// TODO: Adjust card heights (103)
38+
child: Column(
39+
// TODO: Center items on the card (103)
40+
crossAxisAlignment: CrossAxisAlignment.start,
41+
children: <Widget>[
42+
AspectRatio(
43+
aspectRatio: 18 / 11,
44+
child: Image.asset(
45+
product.assetName,
46+
package: product.assetPackage,
47+
fit: BoxFit.fitWidth,
48+
),
49+
),
50+
Expanded(
51+
child: Padding(
52+
padding: EdgeInsets.fromLTRB(16.0, 12.0, 16.0, 8.0),
53+
child: Column(
54+
// TODO: Align labels to the bottom and center (103)
55+
crossAxisAlignment: CrossAxisAlignment.start,
56+
// TODO: Change innermost Column (103)
57+
children: <Widget>[
58+
// TODO(larche): Make headline6 when available
59+
Text(
60+
product.name,
61+
style: theme.textTheme.title,
62+
maxLines: 1,
63+
),
64+
SizedBox(height: 8.0),
65+
// TODO(larche): Make subtitle2 when available
66+
Text(
67+
formatter.format(product.price),
68+
style: theme.textTheme.body2,
69+
),
70+
],
71+
),
72+
),
73+
),
74+
],
75+
),
76+
);
77+
}).toList();
78+
}
79+
2180
@override
2281
Widget build(BuildContext context) {
2382
// TODO: Return an AsymmetricView (104)
2483
// TODO: Pass Category variable to AsymmetricView (104)
84+
2585
return Scaffold(
26-
// TODO: Add app bar (102)
27-
// TODO: Add a grid view (102)
86+
appBar: AppBar(
87+
leading: IconButton(
88+
icon: Icon(Icons.menu),
89+
onPressed: () {
90+
print('Menu button');
91+
},
92+
),
93+
title: Text('SHRINE'),
94+
actions: <Widget>[
95+
IconButton(
96+
icon: Icon(Icons.search),
97+
onPressed: () {
98+
print('Search button');
99+
},
100+
),
101+
IconButton(
102+
icon: Icon(Icons.tune),
103+
onPressed: () {
104+
print('Filter button');
105+
},
106+
),
107+
],
108+
),
28109
body: Center(
29-
child: Text('You did it!'),
110+
child: GridView.count(
111+
crossAxisCount: 2,
112+
padding: EdgeInsets.all(16.0),
113+
childAspectRatio: 8.0 / 9.0,
114+
children: _buildGridCards(context),
115+
),
30116
),
31117
);
32118
}
33119
}
34-

mdc_100_series/lib/login.dart

+3
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,16 @@ class _LoginPageState extends State<LoginPage> {
6060
),
6161
ButtonBar(
6262
children: <Widget>[
63+
// TODO: Add a beveled rectangular border to CANCEL (103)
6364
FlatButton(
6465
child: Text('CANCEL'),
6566
onPressed: () {
6667
_usernameController.clear();
6768
_passwordController.clear();
6869
},
6970
),
71+
// TODO: Add an elevation to NEXT (103)
72+
// TODO: Add a beveled rectangular border to NEXT (103)
7073
RaisedButton(
7174
child: Text('NEXT'),
7275
onPressed: () {

0 commit comments

Comments
 (0)