Skip to content

Commit

Permalink
[102] Completed code.
Browse files Browse the repository at this point in the history
[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.
  • Loading branch information
willlarche authored and tianlunlee committed Jun 26, 2018
1 parent 574253b commit 1ed26aa
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions mdc_100_series/lib/home.dart
Expand Up @@ -13,12 +13,69 @@
// limitations under the License.

import 'package:flutter/material.dart';
import 'package:intl/intl.dart';

import 'model/data.dart';
import 'model/product.dart';

import 'model/data.dart';
import 'model/product.dart';
import 'supplemental/asymmetric_view.dart';

class HomePage extends StatelessWidget {

List<Card> _buildGridCards(BuildContext context) {
List<Product> products = getProducts(Category.all);

if (products == null || products.isEmpty) {
return const <Card>[];
}

final ThemeData theme = Theme.of(context);
final NumberFormat formatter = NumberFormat.simpleCurrency(
locale: Localizations.localeOf(context).toString());

return products.map((product) {
return Card(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
AspectRatio(
aspectRatio: 18 / 11,
child: Image.asset(
product.assetName,
package: product.assetPackage,
fit: BoxFit.fitWidth,
),
),
Expanded(
child: Padding(
padding: EdgeInsets.fromLTRB(16.0, 12.0, 16.0, 8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
// TODO(larche): Make headline6 when available
Text(
product.name,
style: theme.textTheme.title,
maxLines: 1,
),
SizedBox(height: 8.0),
// TODO(larche): Make subtitle2 when available
Text(
formatter.format(product.price),
style: theme.textTheme.body2,
),
],
),
),
),
],
),
);
}).toList();
}

@override
Widget build(BuildContext context) {
return Scaffold(
Expand Down

0 comments on commit 1ed26aa

Please sign in to comment.