pesto_demo.dart 25 KB
Newer Older
1 2 3 4 5
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:flutter/material.dart';
6
import 'package:flutter/rendering.dart';
7

8
class PestoDemo extends StatelessWidget {
9
  const PestoDemo({ Key key }) : super(key: key);
10 11 12 13

  static const String routeName = '/pesto';

  @override
14
  Widget build(BuildContext context) => PestoHome();
15 16
}

17

18
const String _kSmallLogoImage = 'logos/pesto/logo_small.png';
19
const String _kGalleryAssetsPackage = 'flutter_gallery_assets';
20
const double _kAppBarHeight = 128.0;
21
const double _kFabHalfSize = 28.0; // TODO(mpcomplete): needs to adapt to screen size
22 23
const double _kRecipePageMaxWidth = 500.0;

24
final Set<Recipe> _favoriteRecipes = Set<Recipe>();
25

26
final ThemeData _kTheme = ThemeData(
27
  brightness: Brightness.light,
28
  primarySwatch: Colors.teal,
29
  accentColor: Colors.redAccent,
30 31
);

32 33 34
class PestoHome extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
35
    return const RecipeGridPage(recipes: kPestoRecipes);
36 37 38 39 40 41
  }
}

class PestoFavorites extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
42
    return RecipeGridPage(recipes: _favoriteRecipes.toList());
43 44
  }
}
45

46 47
class PestoStyle extends TextStyle {
  const PestoStyle({
48
    double fontSize = 12.0,
49
    FontWeight fontWeight,
50
    Color color = Colors.black87,
51 52
    double letterSpacing,
    double height,
53
  }) : super(
54
    inherit: false,
55
    color: color,
56
    fontFamily: 'Raleway',
57 58 59
    fontSize: fontSize,
    fontWeight: fontWeight,
    textBaseline: TextBaseline.alphabetic,
60 61
    letterSpacing: letterSpacing,
    height: height,
62 63 64
  );
}

65 66
// Displays a grid of recipe cards.
class RecipeGridPage extends StatefulWidget {
67
  const RecipeGridPage({ Key key, this.recipes }) : super(key: key);
68

69
  final List<Recipe> recipes;
70 71

  @override
72
  _RecipeGridPageState createState() => _RecipeGridPageState();
73 74
}

75
class _RecipeGridPageState extends State<RecipeGridPage> {
76
  final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>();
77 78 79

  @override
  Widget build(BuildContext context) {
80
    final double statusBarHeight = MediaQuery.of(context).padding.top;
81
    return Theme(
82
      data: _kTheme.copyWith(platform: Theme.of(context).platform),
83
      child: Scaffold(
84
        key: scaffoldKey,
85
        floatingActionButton: FloatingActionButton(
86
          child: const Icon(Icons.edit),
87
          onPressed: () {
88
            scaffoldKey.currentState.showSnackBar(const SnackBar(
89
              content: Text('Not supported.'),
90
            ));
91
          },
92
        ),
93
        body: CustomScrollView(
94 95 96 97 98
          slivers: <Widget>[
            _buildAppBar(context, statusBarHeight),
            _buildBody(context, statusBarHeight),
          ],
        ),
99
      ),
100 101 102
    );
  }

103
  Widget _buildAppBar(BuildContext context, double statusBarHeight) {
104
    return SliverAppBar(
105
      pinned: true,
106
      expandedHeight: _kAppBarHeight,
107
      actions: <Widget>[
108
        IconButton(
109
          icon: const Icon(Icons.search),
110 111
          tooltip: 'Search',
          onPressed: () {
112
            scaffoldKey.currentState.showSnackBar(const SnackBar(
113
              content: Text('Not supported.'),
114
            ));
115 116
          },
        ),
117
      ],
118
      flexibleSpace: LayoutBuilder(
119 120
        builder: (BuildContext context, BoxConstraints constraints) {
          final Size size = constraints.biggest;
121
          final double appBarHeight = size.height - statusBarHeight;
122
          final double t = (appBarHeight - kToolbarHeight) / (_kAppBarHeight - kToolbarHeight);
123
          final double extraPadding = Tween<double>(begin: 10.0, end: 24.0).transform(t);
124
          final double logoHeight = appBarHeight - 1.5 * extraPadding;
125 126
          return Padding(
            padding: EdgeInsets.only(
127
              top: statusBarHeight + 0.5 * extraPadding,
128
              bottom: extraPadding,
129
            ),
130 131
            child: Center(
              child: PestoLogo(height: logoHeight, t: t.clamp(0.0, 1.0))
132
            ),
133
          );
134 135
        },
      ),
136 137 138
    );
  }

139
  Widget _buildBody(BuildContext context, double statusBarHeight) {
140
    final EdgeInsets mediaPadding = MediaQuery.of(context).padding;
141
    final EdgeInsets padding = EdgeInsets.only(
142 143 144 145 146
      top: 8.0,
      left: 8.0 + mediaPadding.left,
      right: 8.0 + mediaPadding.right,
      bottom: 8.0
    );
147
    return SliverPadding(
148
      padding: padding,
149
      sliver: SliverGrid(
150
        gridDelegate: const SliverGridDelegateWithMaxCrossAxisExtent(
151 152 153 154
          maxCrossAxisExtent: _kRecipePageMaxWidth,
          crossAxisSpacing: 8.0,
          mainAxisSpacing: 8.0,
        ),
155
        delegate: SliverChildBuilderDelegate(
156
          (BuildContext context, int index) {
157
            final Recipe recipe = widget.recipes[index];
158
            return RecipeCard(
159 160 161
              recipe: recipe,
              onTap: () { showRecipePage(context, recipe); },
            );
Ian Hickson's avatar
Ian Hickson committed
162
          },
163
          childCount: widget.recipes.length,
164
        ),
165 166 167 168
      ),
    );
  }

169
  void showFavoritesPage(BuildContext context) {
170
    Navigator.push(context, MaterialPageRoute<void>(
171
      settings: const RouteSettings(name: '/pesto/favorites'),
172
      builder: (BuildContext context) => PestoFavorites(),
173 174 175
    ));
  }

176
  void showRecipePage(BuildContext context, Recipe recipe) {
177
    Navigator.push(context, MaterialPageRoute<void>(
178
      settings: const RouteSettings(name: '/pesto/recipe'),
179
      builder: (BuildContext context) {
180
        return Theme(
181
          data: _kTheme.copyWith(platform: Theme.of(context).platform),
182
          child: RecipePage(recipe: recipe),
183
        );
184
      },
185 186
    ));
  }
187 188 189
}

class PestoLogo extends StatefulWidget {
190
  const PestoLogo({this.height, this.t});
191 192

  final double height;
193
  final double t;
194 195

  @override
196
  _PestoLogoState createState() => _PestoLogoState();
197 198 199 200 201 202 203 204 205
}

class _PestoLogoState extends State<PestoLogo> {
  // Native sizes for logo and its image/text components.
  static const double kLogoHeight = 162.0;
  static const double kLogoWidth = 220.0;
  static const double kImageHeight = 108.0;
  static const double kTextHeight = 48.0;
  final TextStyle titleStyle = const PestoStyle(fontSize: kTextHeight, fontWeight: FontWeight.w900, color: Colors.white, letterSpacing: 3.0);
206 207 208
  final RectTween _textRectTween = RectTween(
    begin: Rect.fromLTWH(0.0, kLogoHeight, kLogoWidth, kTextHeight),
    end: Rect.fromLTWH(0.0, kImageHeight, kLogoWidth, kTextHeight)
209
  );
210
  final Curve _textOpacity = const Interval(0.4, 1.0, curve: Curves.easeInOut);
211 212 213
  final RectTween _imageRectTween = RectTween(
    begin: Rect.fromLTWH(0.0, 0.0, kLogoWidth, kLogoHeight),
    end: Rect.fromLTWH(0.0, 0.0, kLogoWidth, kImageHeight),
214
  );
215 216 217

  @override
  Widget build(BuildContext context) {
218
    return Semantics(
219
      namesRoute: true,
220 221
      child: Transform(
        transform: Matrix4.identity()..scale(widget.height / kLogoHeight),
222
        alignment: Alignment.topCenter,
223
        child: SizedBox(
224
          width: kLogoWidth,
225
          child: Stack(
226 227
            overflow: Overflow.visible,
            children: <Widget>[
228
              Positioned.fromRect(
229
                rect: _imageRectTween.lerp(widget.t),
230
                child: Image.asset(
231 232 233 234
                  _kSmallLogoImage,
                  package: _kGalleryAssetsPackage,
                  fit: BoxFit.contain,
                ),
235
              ),
236
              Positioned.fromRect(
237
                rect: _textRectTween.lerp(widget.t),
238
                child: Opacity(
239
                  opacity: _textOpacity.transform(widget.t),
240
                  child: Text('PESTO', style: titleStyle, textAlign: TextAlign.center),
241
                ),
242
              ),
243 244
            ],
          ),
245 246
        ),
      ),
247 248
    );
  }
249 250
}

251 252
// A card with the recipe's image, author, and title.
class RecipeCard extends StatelessWidget {
253
  const RecipeCard({ Key key, this.recipe, this.onTap }) : super(key: key);
254 255 256 257

  final Recipe recipe;
  final VoidCallback onTap;

258 259 260
  TextStyle get titleStyle => const PestoStyle(fontSize: 24.0, fontWeight: FontWeight.w600);
  TextStyle get authorStyle => const PestoStyle(fontWeight: FontWeight.w500, color: Colors.black54);

261 262
  @override
  Widget build(BuildContext context) {
263
    return GestureDetector(
264
      onTap: onTap,
265 266
      child: Card(
        child: Column(
267 268
          crossAxisAlignment: CrossAxisAlignment.start,
          children: <Widget>[
269
            Hero(
270
              tag: 'packages/$_kGalleryAssetsPackage/${recipe.imagePath}',
271 272 273 274 275 276 277 278
              child: AspectRatio(
                aspectRatio: 4.0 / 3.0,
                child: Image.asset(
                  recipe.imagePath,
                  package: recipe.imagePackage,
                  fit: BoxFit.cover,
                  semanticLabel: recipe.name,
                ),
279
              ),
280
            ),
281 282
            Expanded(
              child: Row(
283
                children: <Widget>[
284
                  Padding(
285
                    padding: const EdgeInsets.all(16.0),
286
                    child: Image.asset(
287 288 289 290
                      recipe.ingredientsImagePath,
                      package: recipe.ingredientsImagePackage,
                      width: 48.0,
                      height: 48.0,
291
                    ),
292
                  ),
293 294
                  Expanded(
                    child: Column(
295 296 297
                      crossAxisAlignment: CrossAxisAlignment.start,
                      mainAxisAlignment: MainAxisAlignment.center,
                      children: <Widget>[
298 299
                        Text(recipe.name, style: titleStyle, softWrap: false, overflow: TextOverflow.ellipsis),
                        Text(recipe.author, style: authorStyle),
300
                      ],
301
                    ),
302 303
                  ),
                ],
304
              ),
305 306
            ),
          ],
307 308
        ),
      ),
309 310 311 312
    );
  }
}

313 314
// Displays one recipe. Includes the recipe sheet with a background image.
class RecipePage extends StatefulWidget {
315
  const RecipePage({ Key key, this.recipe }) : super(key: key);
316 317 318 319

  final Recipe recipe;

  @override
320
  _RecipePageState createState() => _RecipePageState();
321 322
}

323
class _RecipePageState extends State<RecipePage> {
324
  final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
325
  final TextStyle menuItemStyle = const PestoStyle(fontSize: 15.0, color: Colors.black54, height: 24.0/15.0);
326

327 328
  double _getAppBarHeight(BuildContext context) => MediaQuery.of(context).size.height * 0.3;

329 330
  @override
  Widget build(BuildContext context) {
331 332 333 334
    // The full page content with the recipe's image behind it. This
    // adjusts based on the size of the screen. If the recipe sheet touches
    // the edge of the screen, use a slightly different layout.
    final double appBarHeight = _getAppBarHeight(context);
335
    final Size screenSize = MediaQuery.of(context).size;
336
    final bool fullWidth = screenSize.width < _kRecipePageMaxWidth;
337
    final bool isFavorite = _favoriteRecipes.contains(widget.recipe);
338
    return Scaffold(
339
      key: _scaffoldKey,
340
      body: Stack(
341
        children: <Widget>[
342
          Positioned(
343 344 345 346
            top: 0.0,
            left: 0.0,
            right: 0.0,
            height: appBarHeight + _kFabHalfSize,
347
            child: Hero(
348
              tag: 'packages/$_kGalleryAssetsPackage/${widget.recipe.imagePath}',
349
              child: Image.asset(
350
                widget.recipe.imagePath,
351
                package: widget.recipe.imagePackage,
352
                fit: fullWidth ? BoxFit.fitWidth : BoxFit.cover,
353
              ),
354 355
            ),
          ),
356
          CustomScrollView(
357
            slivers: <Widget>[
358
              SliverAppBar(
359 360 361
                expandedHeight: appBarHeight - _kFabHalfSize,
                backgroundColor: Colors.transparent,
                actions: <Widget>[
362
                  PopupMenuButton<String>(
363 364 365 366 367 368 369 370 371
                    onSelected: (String item) {},
                    itemBuilder: (BuildContext context) => <PopupMenuItem<String>>[
                      _buildMenuItem(Icons.share, 'Tweet recipe'),
                      _buildMenuItem(Icons.email, 'Email recipe'),
                      _buildMenuItem(Icons.message, 'Message recipe'),
                      _buildMenuItem(Icons.people, 'Share on Facebook'),
                    ],
                  ),
                ],
372
                flexibleSpace: const FlexibleSpaceBar(
373 374 375 376 377 378
                  background: DecoratedBox(
                    decoration: BoxDecoration(
                      gradient: LinearGradient(
                        begin: Alignment(0.0, -1.0),
                        end: Alignment(0.0, -0.2),
                        colors: <Color>[Color(0x60000000), Color(0x00000000)],
379 380 381 382 383
                      ),
                    ),
                  ),
                ),
              ),
384 385
              SliverToBoxAdapter(
                child: Stack(
386
                  children: <Widget>[
387
                    Container(
388
                      padding: const EdgeInsets.only(top: _kFabHalfSize),
389
                      width: fullWidth ? null : _kRecipePageMaxWidth,
390
                      child: RecipeSheet(recipe: widget.recipe),
391
                    ),
392
                    Positioned(
393
                      right: 16.0,
394 395
                      child: FloatingActionButton(
                        child: Icon(isFavorite ? Icons.favorite : Icons.favorite_border),
396 397 398 399
                        onPressed: _toggleFavorite,
                      ),
                    ),
                  ],
400
                )
401
              ),
402
            ],
403
          ),
404 405
        ],
      ),
406 407 408 409
    );
  }

  PopupMenuItem<String> _buildMenuItem(IconData icon, String label) {
410 411
    return PopupMenuItem<String>(
      child: Row(
412
        children: <Widget>[
413
          Padding(
414
            padding: const EdgeInsets.only(right: 24.0),
415
            child: Icon(icon, color: Colors.black54)
416
          ),
417
          Text(label, style: menuItemStyle),
418 419
        ],
      ),
420 421 422 423 424
    );
  }

  void _toggleFavorite() {
    setState(() {
425 426
      if (_favoriteRecipes.contains(widget.recipe))
        _favoriteRecipes.remove(widget.recipe);
427
      else
428
        _favoriteRecipes.add(widget.recipe);
429 430 431 432
    });
  }
}

433 434 435 436 437
/// Displays the recipe's name and instructions.
class RecipeSheet extends StatelessWidget {
  final TextStyle titleStyle = const PestoStyle(fontSize: 34.0);
  final TextStyle descriptionStyle = const PestoStyle(fontSize: 15.0, color: Colors.black54, height: 24.0/15.0);
  final TextStyle itemStyle = const PestoStyle(fontSize: 15.0, height: 24.0/15.0);
438
  final TextStyle itemAmountStyle = PestoStyle(fontSize: 15.0, color: _kTheme.primaryColor, height: 24.0/15.0);
439
  final TextStyle headingStyle = const PestoStyle(fontSize: 16.0, fontWeight: FontWeight.bold, height: 24.0/15.0);
440

441
  RecipeSheet({ Key key, this.recipe }) : super(key: key);
442 443 444 445 446

  final Recipe recipe;

  @override
  Widget build(BuildContext context) {
447 448
    return Material(
      child: SafeArea(
449 450
        top: false,
        bottom: false,
451
        child: Padding(
452
          padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 40.0),
453
          child: Table(
454
            columnWidths: const <int, TableColumnWidth>{
455
              0: FixedColumnWidth(64.0)
456 457
            },
            children: <TableRow>[
458
              TableRow(
459
                children: <Widget>[
460
                  TableCell(
461
                    verticalAlignment: TableCellVerticalAlignment.middle,
462
                    child: Image.asset(
463 464 465 466 467 468 469 470
                      recipe.ingredientsImagePath,
                      package: recipe.ingredientsImagePackage,
                      width: 32.0,
                      height: 32.0,
                      alignment: Alignment.centerLeft,
                      fit: BoxFit.scaleDown
                    )
                  ),
471
                  TableCell(
472
                    verticalAlignment: TableCellVerticalAlignment.middle,
473
                    child: Text(recipe.name, style: titleStyle)
474 475 476
                  ),
                ]
              ),
477
              TableRow(
478 479
                children: <Widget>[
                  const SizedBox(),
480
                  Padding(
481
                    padding: const EdgeInsets.only(top: 8.0, bottom: 4.0),
482
                    child: Text(recipe.description, style: descriptionStyle)
483 484 485
                  ),
                ]
              ),
486
              TableRow(
487 488
                children: <Widget>[
                  const SizedBox(),
489
                  Padding(
490
                    padding: const EdgeInsets.only(top: 24.0, bottom: 4.0),
491
                    child: Text('Ingredients', style: headingStyle)
492 493 494 495 496 497 498 499
                  ),
                ]
              ),
            ]..addAll(recipe.ingredients.map(
              (RecipeIngredient ingredient) {
                return _buildItemRow(ingredient.amount, ingredient.description);
              }
            ))..add(
500
              TableRow(
501 502
                children: <Widget>[
                  const SizedBox(),
503
                  Padding(
504
                    padding: const EdgeInsets.only(top: 24.0, bottom: 4.0),
505
                    child: Text('Steps', style: headingStyle)
506 507 508 509 510 511 512 513 514
                  ),
                ]
              )
            )..addAll(recipe.steps.map(
              (RecipeStep step) {
                return _buildItemRow(step.duration ?? '', step.description);
              }
            )),
          ),
515 516
        ),
      ),
517 518 519 520
    );
  }

  TableRow _buildItemRow(String left, String right) {
521
    return TableRow(
522
      children: <Widget>[
523
        Padding(
524
          padding: const EdgeInsets.symmetric(vertical: 4.0),
525
          child: Text(left, style: itemAmountStyle),
526
        ),
527
        Padding(
528
          padding: const EdgeInsets.symmetric(vertical: 4.0),
529
          child: Text(right, style: itemStyle),
530 531
        ),
      ],
532 533 534 535 536 537 538 539 540 541
    );
  }
}

class Recipe {
  const Recipe({
    this.name,
    this.author,
    this.description,
    this.imagePath,
542
    this.imagePackage,
543
    this.ingredientsImagePath,
544
    this.ingredientsImagePackage,
545 546 547 548 549 550 551 552
    this.ingredients,
    this.steps
  });

  final String name;
  final String author;
  final String description;
  final String imagePath;
553
  final String imagePackage;
554
  final String ingredientsImagePath;
555
  final String ingredientsImagePackage;
556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573
  final List<RecipeIngredient> ingredients;
  final List<RecipeStep> steps;
}

class RecipeIngredient {
  const RecipeIngredient({this.amount, this.description});

  final String amount;
  final String description;
}

class RecipeStep {
  const RecipeStep({this.duration, this.description});

  final String duration;
  final String description;
}

574 575
const List<Recipe> kPestoRecipes = <Recipe>[
  Recipe(
576
    name: 'Roasted Chicken',
577
    author: 'Peter Carlsson',
578
    ingredientsImagePath: 'food/icons/main.png',
579
    ingredientsImagePackage: _kGalleryAssetsPackage,
580 581
    description: 'The perfect dish to welcome your family and friends with on a crisp autumn night. Pair with roasted veggies to truly impress them.',
    imagePath: 'food/roasted_chicken.png',
582
    imagePackage: _kGalleryAssetsPackage,
583
    ingredients: <RecipeIngredient>[
584 585 586 587
      RecipeIngredient(amount: '1 whole', description: 'Chicken'),
      RecipeIngredient(amount: '1/2 cup', description: 'Butter'),
      RecipeIngredient(amount: '1 tbsp', description: 'Onion powder'),
      RecipeIngredient(amount: '1 tbsp', description: 'Freshly ground pepper'),
588
      RecipeIngredient(amount: '1 tsp', description: 'Salt'),
589
    ],
590
    steps: <RecipeStep>[
591 592
      RecipeStep(duration: '1 min', description: 'Put in oven'),
      RecipeStep(duration: '1hr 45 min', description: 'Cook'),
593
    ],
594
  ),
595
  Recipe(
596
    name: 'Chopped Beet Leaves',
597
    author: 'Trevor Hansen',
598
    ingredientsImagePath: 'food/icons/veggie.png',
599
    ingredientsImagePackage: _kGalleryAssetsPackage,
600 601
    description: 'This vegetable has more to offer than just its root. Beet greens can be tossed into a salad to add some variety or sauteed on its own with some oil and garlic.',
    imagePath: 'food/chopped_beet_leaves.png',
602
    imagePackage: _kGalleryAssetsPackage,
603
    ingredients: <RecipeIngredient>[
604
       RecipeIngredient(amount: '3 cups', description: 'Beet greens'),
605
    ],
606
    steps: <RecipeStep>[
607
      RecipeStep(duration: '5 min', description: 'Chop'),
608
    ],
609
  ),
610
  Recipe(
611
    name: 'Pesto Pasta',
612
    author: 'Ali Connors',
613
    ingredientsImagePath: 'food/icons/main.png',
614
    ingredientsImagePackage: _kGalleryAssetsPackage,
615 616
    description: 'With this pesto recipe, you can quickly whip up a meal to satisfy your savory needs. And if you\'re feeling festive, you can add bacon to taste.',
    imagePath: 'food/pesto_pasta.png',
617
    imagePackage: _kGalleryAssetsPackage,
618
    ingredients: <RecipeIngredient>[
619 620 621 622 623 624 625 626 627
      RecipeIngredient(amount: '1/4 cup ', description: 'Pasta'),
      RecipeIngredient(amount: '2 cups', description: 'Fresh basil leaves'),
      RecipeIngredient(amount: '1/2 cup', description: 'Parmesan cheese'),
      RecipeIngredient(amount: '1/2 cup', description: 'Extra virgin olive oil'),
      RecipeIngredient(amount: '1/3 cup', description: 'Pine nuts'),
      RecipeIngredient(amount: '1/4 cup', description: 'Lemon juice'),
      RecipeIngredient(amount: '3 cloves', description: 'Garlic'),
      RecipeIngredient(amount: '1/4 tsp', description: 'Salt'),
      RecipeIngredient(amount: '1/8 tsp', description: 'Pepper'),
628
      RecipeIngredient(amount: '3 lbs', description: 'Bacon'),
629
    ],
630
    steps: <RecipeStep>[
631
      RecipeStep(duration: '15 min', description: 'Blend'),
632
    ],
633
  ),
634
  Recipe(
635
    name: 'Cherry Pie',
636
    author: 'Sandra Adams',
637
    ingredientsImagePath: 'food/icons/main.png',
638
    ingredientsImagePackage: _kGalleryAssetsPackage,
639 640
    description: 'Sometimes when you\'re craving some cheer in your life you can jumpstart your day with some cherry pie. Dessert for breakfast is perfectly acceptable.',
    imagePath: 'food/cherry_pie.png',
641
    imagePackage: _kGalleryAssetsPackage,
642
    ingredients: <RecipeIngredient>[
643 644 645 646 647
      RecipeIngredient(amount: '1', description: 'Pie crust'),
      RecipeIngredient(amount: '4 cups', description: 'Fresh or frozen cherries'),
      RecipeIngredient(amount: '1 cup', description: 'Granulated sugar'),
      RecipeIngredient(amount: '4 tbsp', description: 'Cornstarch'),
      RecipeIngredient(amount: '1½ tbsp', description: 'Butter'),
648
    ],
649
    steps: <RecipeStep>[
650 651
      RecipeStep(duration: '15 min', description: 'Mix'),
      RecipeStep(duration: '1hr 30 min', description: 'Bake'),
652
    ],
653
  ),
654
  Recipe(
655
    name: 'Spinach Salad',
656
    author: 'Peter Carlsson',
657
    ingredientsImagePath: 'food/icons/spicy.png',
658
    ingredientsImagePackage: _kGalleryAssetsPackage,
659 660
    description: 'Everyone\'s favorite leafy green is back. Paired with fresh sliced onion, it\'s ready to tackle any dish, whether it be a salad or an egg scramble.',
    imagePath: 'food/spinach_onion_salad.png',
661
    imagePackage: _kGalleryAssetsPackage,
662
    ingredients: <RecipeIngredient>[
663 664
      RecipeIngredient(amount: '4 cups', description: 'Spinach'),
      RecipeIngredient(amount: '1 cup', description: 'Sliced onion'),
665
    ],
666
    steps: <RecipeStep>[
667
      RecipeStep(duration: '5 min', description: 'Mix'),
668
    ],
669
  ),
670
  Recipe(
671
    name: 'Butternut Squash Soup',
672
    author: 'Ali Connors',
673
    ingredientsImagePath: 'food/icons/healthy.png',
674
    ingredientsImagePackage: _kGalleryAssetsPackage,
675 676
    description: 'This creamy butternut squash soup will warm you on the chilliest of winter nights and bring a delightful pop of orange to the dinner table.',
    imagePath: 'food/butternut_squash_soup.png',
677
    imagePackage: _kGalleryAssetsPackage,
678
    ingredients: <RecipeIngredient>[
679 680 681 682 683 684 685 686
      RecipeIngredient(amount: '1', description: 'Butternut squash'),
      RecipeIngredient(amount: '4 cups', description: 'Chicken stock'),
      RecipeIngredient(amount: '2', description: 'Potatoes'),
      RecipeIngredient(amount: '1', description: 'Onion'),
      RecipeIngredient(amount: '1', description: 'Carrot'),
      RecipeIngredient(amount: '1', description: 'Celery'),
      RecipeIngredient(amount: '1 tsp', description: 'Salt'),
      RecipeIngredient(amount: '1 tsp', description: 'Pepper'),
687
    ],
688
    steps: <RecipeStep>[
689 690 691
      RecipeStep(duration: '10 min', description: 'Prep vegetables'),
      RecipeStep(duration: '5 min', description: 'Stir'),
      RecipeStep(duration: '1 hr 10 min', description: 'Cook')
692
    ],
693
  ),
694
  Recipe(
695
    name: 'Spanakopita',
696
    author: 'Trevor Hansen',
697
    ingredientsImagePath: 'food/icons/quick.png',
698
    ingredientsImagePackage: _kGalleryAssetsPackage,
699 700
    description: 'You \'feta\' believe this is a crowd-pleaser! Flaky phyllo pastry surrounds a delicious mixture of spinach and cheeses to create the perfect appetizer.',
    imagePath: 'food/spanakopita.png',
701
    imagePackage: _kGalleryAssetsPackage,
702
    ingredients: <RecipeIngredient>[
703 704 705 706 707 708
      RecipeIngredient(amount: '1 lb', description: 'Spinach'),
      RecipeIngredient(amount: '½ cup', description: 'Feta cheese'),
      RecipeIngredient(amount: '½ cup', description: 'Cottage cheese'),
      RecipeIngredient(amount: '2', description: 'Eggs'),
      RecipeIngredient(amount: '1', description: 'Onion'),
      RecipeIngredient(amount: '½ lb', description: 'Phyllo dough'),
709
    ],
710
    steps: <RecipeStep>[
711 712 713 714
      RecipeStep(duration: '5 min', description: 'Sauté vegetables'),
      RecipeStep(duration: '3 min', description: 'Stir vegetables and other filling ingredients'),
      RecipeStep(duration: '10 min', description: 'Fill phyllo squares half-full with filling and fold.'),
      RecipeStep(duration: '40 min', description: 'Bake')
715
    ],
716 717
  ),
];