Adds model layer and list view to veggieseasons. (#13)

pull/15/head
Andrew Brogdon 6 years ago committed by GitHub
parent 928c40c097
commit 0675b1f774
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

@ -0,0 +1,592 @@
// Copyright 2018 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.
import 'package:veggieseasons/data/veggie.dart';
class LocalVeggieProvider {
static List<Veggie> veggies = [
Veggie(
id: 1,
name: 'Apples',
imageAssetPath: 'assets/images/placeholder.png',
category: VeggieCategory.fruit,
shortDescription: 'Green or red, they\'re generally round and tasty.',
accentColor: 0xff206010,
seasons: [Season.winter, Season.spring, Season.summer, Season.autumn],
),
Veggie(
id: 2,
name: 'Apricots',
imageAssetPath: 'assets/images/placeholder.png',
category: VeggieCategory.stoneFruit,
shortDescription: 'Dried or in jam, they add a tasty zing to recipes.',
accentColor: 0xff206010,
seasons: [Season.spring, Season.summer],
),
Veggie(
id: 3,
name: 'Asparagus',
imageAssetPath: 'assets/images/placeholder.png',
category: VeggieCategory.fern,
shortDescription: 'It\'s been used a food and medicine for millenia.',
accentColor: 0xff206010,
seasons: [Season.spring],
),
Veggie(
id: 4,
name: 'Avocado',
imageAssetPath: 'assets/images/placeholder.png',
category: VeggieCategory.stealthFruit,
shortDescription: 'One of the oiliest, richest vegetables money can buy.',
accentColor: 0xff206010,
seasons: [Season.winter, Season.spring, Season.summer],
),
Veggie(
id: 5,
name: 'Bananas',
imageAssetPath: 'assets/images/placeholder.png',
category: VeggieCategory.tropical,
shortDescription: 'You\'re probably opening the wrong end.',
accentColor: 0xff206010,
seasons: [Season.winter, Season.spring, Season.summer, Season.autumn],
),
Veggie(
id: 6,
name: 'Beets',
imageAssetPath: 'assets/images/placeholder.png',
category: VeggieCategory.root,
shortDescription: 'Rich, earthy beets add hearty notes to many dishes.',
accentColor: 0xff206010,
seasons: [Season.winter, Season.summer, Season.autumn],
),
Veggie(
id: 7,
name: 'Bell Peppers',
imageAssetPath: 'assets/images/placeholder.png',
category: VeggieCategory.stealthFruit,
shortDescription: 'All the colors of a traffic light, in veggie form.',
accentColor: 0xff206010,
seasons: [Season.summer, Season.autumn],
),
Veggie(
id: 8,
name: 'Blackberries',
imageAssetPath: 'assets/images/placeholder.png',
category: VeggieCategory.berry,
shortDescription: 'Find them on backroads and fences in the Northwest.',
accentColor: 0xff206010,
seasons: [Season.summer],
),
Veggie(
id: 9,
name: 'Blueberries',
imageAssetPath: 'assets/images/placeholder.png',
category: VeggieCategory.berry,
shortDescription: 'Popular in pies, they macerate nicely.',
accentColor: 0xff206010,
seasons: [Season.summer],
),
Veggie(
id: 10,
name: 'Broccoli',
imageAssetPath: 'assets/images/placeholder.png',
category: VeggieCategory.cruciferous,
shortDescription: 'Try garlic salt and oven-frying for a tasty treat.',
accentColor: 0xff206010,
seasons: [Season.spring, Season.autumn],
),
Veggie(
id: 11,
name: 'Brussels Sprouts',
imageAssetPath: 'assets/images/placeholder.png',
category: VeggieCategory.cruciferous,
shortDescription:
'They\'re basically tiny cabbages. Everyone knows this.',
accentColor: 0xff206010,
seasons: [Season.winter, Season.autumn],
),
Veggie(
id: 12,
name: 'Cabbage',
imageAssetPath: 'assets/images/placeholder.png',
category: VeggieCategory.cruciferous,
shortDescription: 'Lettuce\'s tougher, meaner cousin.',
accentColor: 0xff206010,
seasons: [Season.winter, Season.spring, Season.autumn],
),
Veggie(
id: 13,
name: 'Canteloupe',
imageAssetPath: 'assets/images/placeholder.png',
category: VeggieCategory.melon,
shortDescription: 'A fruit so tasty there\'s a utensil just for it.',
accentColor: 0xff206010,
seasons: [Season.summer],
),
Veggie(
id: 14,
name: 'Carrots',
imageAssetPath: 'assets/images/placeholder.png',
category: VeggieCategory.root,
shortDescription: 'They come in a variety of colors and shapes.',
accentColor: 0xff206010,
seasons: [Season.winter, Season.spring, Season.summer, Season.autumn],
),
Veggie(
id: 15,
name: 'Cauliflower',
imageAssetPath: 'assets/images/placeholder.png',
category: VeggieCategory.cruciferous,
shortDescription: 'Looks like white broccoli and explodes when cut.',
accentColor: 0xff206010,
seasons: [Season.autumn],
),
Veggie(
id: 16,
name: 'Celery',
imageAssetPath: 'assets/images/placeholder.png',
category: VeggieCategory.leafy,
shortDescription: 'One of the holy trinity of Cajun cuisine.',
accentColor: 0xff206010,
seasons: [Season.winter, Season.spring, Season.summer, Season.autumn],
),
Veggie(
id: 17,
name: 'Cherries',
imageAssetPath: 'assets/images/placeholder.png',
category: VeggieCategory.berry,
shortDescription: 'Great for topping sundaes and such.',
accentColor: 0xff206010,
seasons: [Season.summer],
),
Veggie(
id: 18,
name: 'Collard Greens',
imageAssetPath: 'assets/images/placeholder.png',
category: VeggieCategory.cruciferous,
shortDescription: 'Slow cook \'em with a ham hock or two.',
accentColor: 0xff206010,
seasons: [Season.spring, Season.summer, Season.autumn],
),
Veggie(
id: 19,
name: 'Corn',
imageAssetPath: 'assets/images/placeholder.png',
category: VeggieCategory.stealthFruit,
shortDescription: 'Popped, roasted, creamed or grilled, it\'s all good.',
accentColor: 0xff206010,
seasons: [Season.summer],
),
Veggie(
id: 20,
name: 'Cranberries',
imageAssetPath: 'assets/images/placeholder.png',
category: VeggieCategory.berry,
shortDescription: 'A popular juice when mixed with other fruits.',
accentColor: 0xff206010,
seasons: [Season.autumn],
),
Veggie(
id: 21,
name: 'Cucumbers',
imageAssetPath: 'assets/images/placeholder.png',
category: VeggieCategory.gourd,
shortDescription:
'Crisp, clean, and a surprisingly good veggie to juice.',
accentColor: 0xff206010,
seasons: [Season.summer],
),
Veggie(
id: 22,
name: 'Eggplant',
imageAssetPath: 'assets/images/placeholder.png',
category: VeggieCategory.stealthFruit,
shortDescription: 'Big and purple. That\'s about it.',
accentColor: 0xff206010,
seasons: [Season.summer],
),
Veggie(
id: 23,
name: 'Garlic',
imageAssetPath: 'assets/images/placeholder.png',
category: VeggieCategory.allium,
shortDescription: 'Can flavor your food in innumerable ways.',
accentColor: 0xff206010,
seasons: [Season.spring, Season.summer, Season.autumn],
),
Veggie(
id: 24,
name: 'Ginger',
imageAssetPath: 'assets/images/placeholder.png',
category: VeggieCategory.tropical,
shortDescription: 'Quick tip: Peel, blend, and freeze ginger for later.',
accentColor: 0xff206010,
seasons: [Season.autumn],
),
Veggie(
id: 25,
name: 'Grapefruit',
imageAssetPath: 'assets/images/placeholder.png',
category: VeggieCategory.citrus,
shortDescription: 'Ruby red for juice, and regular ones for breakfast.',
accentColor: 0xff206010,
seasons: [
Season.winter,
],
),
Veggie(
id: 26,
name: 'Grapes',
imageAssetPath: 'assets/images/placeholder.png',
category: VeggieCategory.berry,
shortDescription: 'Couldn\'t have wine without them.',
accentColor: 0xff206010,
seasons: [Season.autumn],
),
Veggie(
id: 26,
name: 'Green Beans',
imageAssetPath: 'assets/images/placeholder.png',
category: VeggieCategory.legume,
shortDescription: 'Popular with toddlers and in hamburger hot dish.',
accentColor: 0xff206010,
seasons: [Season.summer],
),
Veggie(
id: 27,
name: 'Greens',
imageAssetPath: 'assets/images/placeholder.png',
category: VeggieCategory.leafy,
shortDescription: 'Salad when raw, side dish when slow-cooked.',
accentColor: 0xff206010,
seasons: [Season.spring, Season.autumn],
),
Veggie(
id: 28,
name: 'Honeydew Melon',
imageAssetPath: 'assets/images/placeholder.png',
category: VeggieCategory.melon,
shortDescription: 'It\'s like a canteloupe, but all green inside.',
accentColor: 0xff206010,
seasons: [Season.summer],
),
Veggie(
id: 29,
name: 'Kale',
imageAssetPath: 'assets/images/placeholder.png',
category: VeggieCategory.cruciferous,
shortDescription: 'The meanest vegetable. Does not want to be eaten.',
accentColor: 0xff206010,
seasons: [Season.winter, Season.autumn],
),
Veggie(
id: 30,
name: 'Kiwi',
imageAssetPath: 'assets/images/placeholder.png',
category: VeggieCategory.berry,
shortDescription: 'Also known as Chinese gooseberry.',
accentColor: 0xff206010,
seasons: [Season.summer],
),
Veggie(
id: 31,
name: 'Leeks',
imageAssetPath: 'assets/images/placeholder.png',
category: VeggieCategory.allium,
shortDescription: 'Couldn\'t have vichyssoise without them.',
accentColor: 0xff206010,
seasons: [
Season.winter,
],
),
Veggie(
id: 32,
name: 'Lemons',
imageAssetPath: 'assets/images/placeholder.png',
category: VeggieCategory.citrus,
shortDescription: 'Similar to limes, only yellow.',
accentColor: 0xff206010,
seasons: [
Season.winter,
],
),
Veggie(
id: 33,
name: 'Lettuce',
imageAssetPath: 'assets/images/placeholder.png',
category: VeggieCategory.leafy,
shortDescription: 'Great on a sandwich or as the base for a salad.',
accentColor: 0xff206010,
seasons: [Season.spring, Season.autumn],
),
Veggie(
id: 34,
name: 'Lima Beans',
imageAssetPath: 'assets/images/placeholder.png',
category: VeggieCategory.legume,
shortDescription: 'Legumes are healthy. We all know this.',
accentColor: 0xff206010,
seasons: [Season.summer],
),
Veggie(
id: 35,
name: 'Mangos',
imageAssetPath: 'assets/images/placeholder.png',
category: VeggieCategory.tropical,
shortDescription:
'Bright orange fruit popular with smoothie enthusiasts.',
accentColor: 0xff206010,
seasons: [Season.summer, Season.autumn],
),
Veggie(
id: 36,
name: 'Mushrooms',
imageAssetPath: 'assets/images/placeholder.png',
category: VeggieCategory.fungus,
shortDescription:
'They\'re not truffles, but they\'re still pretty good.',
accentColor: 0xff206010,
seasons: [Season.spring, Season.autumn],
),
Veggie(
id: 37,
name: 'Nectarines',
imageAssetPath: 'assets/images/placeholder.png',
category: VeggieCategory.citrus,
shortDescription: 'A tiny citrus fruit.',
accentColor: 0xff206010,
seasons: [Season.summer],
),
Veggie(
id: 38,
name: 'Okra',
imageAssetPath: 'assets/images/placeholder.png',
category: VeggieCategory.vegetable,
shortDescription: 'Great in stews and straight-up delicious when fried.',
accentColor: 0xff206010,
seasons: [Season.summer],
),
Veggie(
id: 39,
name: 'Onions',
imageAssetPath: 'assets/images/placeholder.png',
category: VeggieCategory.allium,
shortDescription: 'Probably best not to eat them all at once.',
accentColor: 0xff206010,
seasons: [Season.winter, Season.spring, Season.autumn],
),
Veggie(
id: 40,
name: 'Oranges',
imageAssetPath: 'assets/images/placeholder.png',
category: VeggieCategory.citrus,
shortDescription: 'Slice them up and give them to your soccer team.',
accentColor: 0xff206010,
seasons: [
Season.winter,
],
),
Veggie(
id: 41,
name: 'Parsnips',
imageAssetPath: 'assets/images/placeholder.png',
category: VeggieCategory.root,
shortDescription:
'If a carrot and a potato had a baby, this would be it.',
accentColor: 0xff206010,
seasons: [Season.winter, Season.autumn],
),
Veggie(
id: 42,
name: 'Peaches',
imageAssetPath: 'assets/images/placeholder.png',
category: VeggieCategory.stoneFruit,
shortDescription: 'Number one fruit for cobbler.',
accentColor: 0xff206010,
seasons: [Season.summer],
),
Veggie(
id: 43,
name: 'Pears',
imageAssetPath: 'assets/images/placeholder.png',
category: VeggieCategory.fruit,
shortDescription: 'Similar to apples, but gentler and prone to bruising.',
accentColor: 0xff206010,
seasons: [Season.winter, Season.autumn],
),
Veggie(
id: 44,
name: 'Peas',
imageAssetPath: 'assets/images/placeholder.png',
category: VeggieCategory.legume,
shortDescription: 'Little green spheres of deliciousness.',
accentColor: 0xff206010,
seasons: [Season.spring, Season.autumn],
),
Veggie(
id: 45,
name: 'Pineapple',
imageAssetPath: 'assets/images/placeholder.png',
category: VeggieCategory.citrus,
shortDescription: 'The porcupine of fruit, it must be handled with care.',
accentColor: 0xff206010,
seasons: [Season.winter, Season.spring, Season.autumn],
),
Veggie(
id: 46,
name: 'Plums',
imageAssetPath: 'assets/images/placeholder.png',
category: VeggieCategory.stoneFruit,
shortDescription: 'Popular in fruit salads and children\'s tales.',
accentColor: 0xff206010,
seasons: [Season.summer],
),
Veggie(
id: 47,
name: 'Potatoes',
imageAssetPath: 'assets/images/placeholder.png',
category: VeggieCategory.tuber,
shortDescription: 'King of starches and giver of french fries.',
accentColor: 0xff206010,
seasons: [Season.winter, Season.autumn],
),
Veggie(
id: 48,
name: 'Pumpkins',
imageAssetPath: 'assets/images/placeholder.png',
category: VeggieCategory.gourd,
shortDescription: 'The largest ever pumpkin weighed 2,624 pounds.',
accentColor: 0xff206010,
seasons: [Season.winter, Season.autumn],
),
Veggie(
id: 49,
name: 'Radishes',
imageAssetPath: 'assets/images/placeholder.png',
category: VeggieCategory.root,
shortDescription: 'Try roasting them in addition to slicing them up raw.',
accentColor: 0xff206010,
seasons: [Season.spring, Season.autumn],
),
Veggie(
id: 50,
name: 'Raspberries',
imageAssetPath: 'assets/images/placeholder.png',
category: VeggieCategory.berry,
shortDescription: 'My daughter puts them on her fingertips.',
accentColor: 0xff206010,
seasons: [Season.summer, Season.autumn],
),
Veggie(
id: 51,
name: 'Rhubarb',
imageAssetPath: 'assets/images/placeholder.png',
category: VeggieCategory.vegetable,
shortDescription: 'Classic pie ingredient when combined with strawberry.',
accentColor: 0xff206010,
seasons: [Season.spring],
),
Veggie(
id: 52,
name: 'Rutabagas',
imageAssetPath: 'assets/images/placeholder.png',
category: VeggieCategory.root,
shortDescription: 'Can last further into winter than almost anything.',
accentColor: 0xff206010,
seasons: [Season.winter, Season.autumn],
),
Veggie(
id: 53,
name: 'Spinach',
imageAssetPath: 'assets/images/placeholder.png',
category: VeggieCategory.leafy,
shortDescription: 'Great source of iron and other nutrients.',
accentColor: 0xff206010,
seasons: [Season.spring, Season.autumn],
),
Veggie(
id: 54,
name: 'Strawberries',
imageAssetPath: 'assets/images/placeholder.png',
category: VeggieCategory.berry,
shortDescription:
'A delicious fruit that keeps its seeds on the outside.',
accentColor: 0xff206010,
seasons: [Season.spring, Season.summer],
),
Veggie(
id: 55,
name: 'Summer Squash',
imageAssetPath: 'assets/images/placeholder.png',
category: VeggieCategory.gourd,
shortDescription: 'We call green ones zucchini. Still squash, though.',
accentColor: 0xff206010,
seasons: [Season.summer],
),
Veggie(
id: 56,
name: 'Sweet Potatoes',
imageAssetPath: 'assets/images/placeholder.png',
category: VeggieCategory.root,
shortDescription: 'Somehow lower in glycemic index than normal potatoes.',
accentColor: 0xff206010,
seasons: [Season.winter, Season.autumn],
),
Veggie(
id: 57,
name: 'Swiss Chard',
imageAssetPath: 'assets/images/placeholder.png',
category: VeggieCategory.leafy,
shortDescription: 'Chard than enjoys skiing and fine chocolate.',
accentColor: 0xff206010,
seasons: [Season.spring, Season.autumn],
),
Veggie(
id: 58,
name: 'Tomatillos',
imageAssetPath: 'assets/images/placeholder.png',
category: VeggieCategory.stealthFruit,
shortDescription:
'The little green tomato things people make salsa from.',
accentColor: 0xff206010,
seasons: [Season.summer],
),
Veggie(
id: 59,
name: 'Tomatoes',
imageAssetPath: 'assets/images/placeholder.png',
category: VeggieCategory.stealthFruit,
shortDescription: 'A new world food with old world tradition.',
accentColor: 0xff206010,
seasons: [Season.summer],
),
Veggie(
id: 60,
name: 'Turnips',
imageAssetPath: 'assets/images/placeholder.png',
category: VeggieCategory.root,
shortDescription: 'Can be mixed with mashed potatoes for a light side.',
accentColor: 0xff206010,
seasons: [Season.winter, Season.spring, Season.autumn],
),
Veggie(
id: 61,
name: 'Watermelon',
imageAssetPath: 'assets/images/placeholder.png',
category: VeggieCategory.melon,
shortDescription: 'Everyone\'s favorite closing act at the picnic.',
accentColor: 0xff206010,
seasons: [Season.summer],
),
Veggie(
id: 62,
name: 'Winter Squash',
imageAssetPath: 'assets/images/placeholder.png',
category: VeggieCategory.gourd,
shortDescription: 'Bigger and heartier than summer squashes.',
accentColor: 0xff206010,
seasons: [Season.winter, Season.autumn],
),
];
}

@ -0,0 +1,73 @@
// Copyright 2018 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.
import 'package:scoped_model/scoped_model.dart';
import 'package:veggieseasons/data/veggie.dart';
import 'package:veggieseasons/data/local_veggie_provider.dart';
class AppState extends Model {
List<Veggie> _veggies;
AppState() : _veggies = LocalVeggieProvider.veggies;
List<Veggie> get allVeggies => List<Veggie>.from(_veggies);
Veggie getVeggie(int id) => _veggies.singleWhere((v) => v.id == id);
List<Veggie> get availableVeggies {
Season currentSeason = _getSeasonForDate(DateTime.now());
return _veggies.where((v) => v.seasons.contains(currentSeason)).toList();
}
List<Veggie> get unavailableVeggies {
Season currentSeason = _getSeasonForDate(DateTime.now());
return _veggies.where((v) => !v.seasons.contains(currentSeason)).toList();
}
List<Veggie> get favoriteVeggies =>
_veggies.where((v) => v.isFavorite).toList();
List<Veggie> searchVeggies(String terms) => _veggies
.where((v) => v.name.toLowerCase().contains(terms.toLowerCase()))
.toList();
void toggleFavorite(int id) {
Veggie veggie = getVeggie(id);
veggie.isFavorite = !veggie.isFavorite;
notifyListeners();
}
static Season _getSeasonForDate(DateTime date) {
// Technically the start and end dates of seasons can vary by a day or so,
// but this is close enough for produce.
switch (date.month) {
case 1:
return Season.winter;
case 2:
return Season.winter;
case 3:
return date.day < 21 ? Season.winter : Season.spring;
case 4:
return Season.spring;
case 5:
return Season.spring;
case 6:
return date.day < 21 ? Season.spring : Season.summer;
case 7:
return Season.summer;
case 8:
return Season.summer;
case 9:
return date.day < 22 ? Season.autumn : Season.winter;
case 10:
return Season.autumn;
case 11:
return Season.autumn;
case 12:
return date.day < 22 ? Season.autumn : Season.winter;
default:
throw ArgumentError('Can\'t return a season for month #${date.month}.');
}
}
}

@ -4,6 +4,8 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/services.dart' show DeviceOrientation, SystemChrome;
import 'package:scoped_model/scoped_model.dart';
import 'package:veggieseasons/data/model.dart';
import 'package:veggieseasons/screens/home.dart';
import 'package:veggieseasons/styles.dart';
@ -14,9 +16,12 @@ void main() {
]);
runApp(
CupertinoApp(
color: Styles.appBackground,
home: HomeScreen(),
ScopedModel<AppState>(
model: AppState(),
child: CupertinoApp(
color: Styles.appBackground,
home: HomeScreen(),
),
),
);
}

@ -4,19 +4,65 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/widgets.dart';
import 'package:intl/intl.dart';
import 'package:scoped_model/scoped_model.dart';
import 'package:veggieseasons/data/model.dart';
import 'package:veggieseasons/data/veggie.dart';
import 'package:veggieseasons/styles.dart';
import 'package:veggieseasons/widgets/veggie_headline.dart';
class ListScreen extends StatelessWidget {
List<Widget> _generateVeggieRows(List<Veggie> veggies) {
final cards = new List<Widget>();
for (Veggie veggie in veggies) {
cards.add(Padding(
padding: EdgeInsets.only(left: 16.0, right: 16.0, bottom: 24.0),
child: VeggieHeadline(veggie),
));
}
return cards;
}
@override
Widget build(BuildContext context) {
return CupertinoPageScaffold(
navigationBar: CupertinoNavigationBar(
middle: Text('List'),
String dateString = DateFormat.yMMMMd("en_US").format(DateTime.now());
final model = ScopedModel.of<AppState>(context, rebuildOnChange: true);
final rows = <Widget>[];
rows.add(
Padding(
padding: const EdgeInsets.fromLTRB(16.0, 24.0, 16.0, 16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(dateString.toUpperCase(), style: Styles.minorText),
Text('In season today', style: Styles.headlineText),
],
),
),
backgroundColor: Styles.scaffoldBackground,
child: Center(
child: Text('Not yet implemented.'),
);
rows.addAll(_generateVeggieRows(model.availableVeggies));
rows.add(
Padding(
padding: const EdgeInsets.fromLTRB(16.0, 24.0, 16.0, 16.0),
child: Text('Not in season', style: Styles.headlineText),
),
);
rows.addAll(_generateVeggieRows(model.unavailableVeggies));
return CupertinoTabView(
builder: (context) => DecoratedBox(
decoration: BoxDecoration(color: Color(0xffffffff)),
child: ListView(
children: rows,
),
),
);
}
}

@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/widgets.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/widgets.dart';
import 'package:veggieseasons/data/veggie.dart';
abstract class Styles {

@ -0,0 +1,74 @@
// Copyright 2018 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.
import 'package:flutter/cupertino.dart';
import 'package:veggieseasons/data/veggie.dart';
import 'package:veggieseasons/styles.dart';
class VeggieHeadline extends StatelessWidget {
final Veggie veggie;
const VeggieHeadline(this.veggie);
List<Widget> _buildSeasonDots(List<Season> seasons) {
List<Widget> widgets = <Widget>[];
for (Season season in seasons) {
widgets.add(SizedBox(width: 4.0));
widgets.add(
Container(
height: 10.0,
width: 10.0,
decoration: BoxDecoration(
color: Styles.seasonColors[season],
borderRadius: BorderRadius.circular(5.0),
),
),
);
}
return widgets;
}
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () {
/* TODO(redbrogdon): navigation forthcoming */
},
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
width: 80.0,
height: 80.0,
child: ClipRRect(
borderRadius: BorderRadius.circular(10.0),
child: Image.asset(
veggie.imageAssetPath,
fit: BoxFit.fitWidth,
),
),
),
SizedBox(width: 8.0),
Flexible(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: <Widget>[
Text(veggie.name, style: Styles.headlineName),
]..addAll(_buildSeasonDots(veggie.seasons)),
),
Text(veggie.shortDescription,
style: Styles.headlineDescription),
],
),
)
],
),
);
}
}

@ -11,9 +11,26 @@ dependencies:
sdk: flutter
cupertino_icons: ^0.1.2
intl: ^0.15.7
scoped_model: ^0.3.0
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
assets:
- assets/images/placeholder.png
fonts:
- family: NotoSans
fonts:
- asset: assets/fonts/NotoSans-Regular.ttf
weight: 400
- asset: assets/fonts/NotoSans-Bold.ttf
weight: 700
- asset: assets/fonts/NotoSans-BoldItalic.ttf
weight: 700
style: italic
- asset: assets/fonts/NotoSans-Italic.ttf
style: italic
weight: 400
Loading…
Cancel
Save