Adds new image assets, card-style list, and new data for the veggies ()

pull/40/head
Andrew Brogdon 6 years ago committed by GitHub
parent 2a2c535aab
commit bfb8b8aea9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 210 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 305 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 281 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 271 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 187 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 169 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 214 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 190 KiB

@ -2,6 +2,7 @@
// 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';
class LocalVeggieProvider {
@ -9,584 +10,273 @@ class LocalVeggieProvider {
Veggie(
id: 1,
name: 'Apples',
imageAssetPath: 'assets/images/placeholder.png',
imageAssetPath: 'assets/images/apple.jpg',
category: VeggieCategory.fruit,
shortDescription: 'Green or red, they\'re generally round and tasty.',
accentColor: 0xff206010,
accentColor: Color(0x40de8c66),
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],
name: 'Artichokes',
imageAssetPath: 'assets/images/artichoke.jpg',
category: VeggieCategory.flower,
shortDescription: 'The armadillo of vegetables.',
accentColor: Color(0x408ea26d),
seasons: [Season.autumn, Season.spring],
),
Veggie(
id: 3,
name: 'Asparagus',
imageAssetPath: 'assets/images/placeholder.png',
imageAssetPath: 'assets/images/asparagus.jpg',
category: VeggieCategory.fern,
shortDescription: 'It\'s been used a food and medicine for millenia.',
accentColor: 0xff206010,
accentColor: Color(0x408cb437),
seasons: [Season.spring],
),
Veggie(
id: 4,
name: 'Avocado',
imageAssetPath: 'assets/images/placeholder.png',
imageAssetPath: 'assets/images/avocado.jpg',
category: VeggieCategory.stealthFruit,
shortDescription: 'One of the oiliest, richest vegetables money can buy.',
accentColor: 0xff206010,
accentColor: Color(0x40b0ba59),
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',
imageAssetPath: 'assets/images/blackberry.jpg',
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,
accentColor: Color(0x409d5adb),
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,
id: 6,
name: 'Canteloupe',
imageAssetPath: 'assets/images/placeholder.png',
imageAssetPath: 'assets/images/canteloupe.jpg',
category: VeggieCategory.melon,
shortDescription: 'A fruit so tasty there\'s a utensil just for it.',
accentColor: 0xff206010,
accentColor: Color(0x40f6bd56),
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,
id: 7,
name: 'Cauliflower',
imageAssetPath: 'assets/images/placeholder.png',
imageAssetPath: 'assets/images/cauliflower.jpg',
category: VeggieCategory.cruciferous,
shortDescription: 'Looks like white broccoli and explodes when cut.',
accentColor: 0xff206010,
accentColor: Color(0x40c891a8),
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',
id: 8,
name: 'Endive',
imageAssetPath: 'assets/images/endive.jpg',
category: VeggieCategory.gourd,
shortDescription:
'Crisp, clean, and a surprisingly good veggie to juice.',
accentColor: 0xff206010,
seasons: [Season.summer],
shortDescription: 'It\'s basically the veal of lettuce.',
accentColor: Color(0x40c5be53),
seasons: [Season.winter, Season.autumn, Season.spring],
),
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,
],
id: 9,
name: 'Figs',
imageAssetPath: 'assets/images/fig.jpg',
category: VeggieCategory.fruit,
shortDescription: 'Delicious when sliced and wrapped in prosciutto.',
accentColor: Color(0x40aa6d7c),
seasons: [Season.autumn, Season.summer],
),
Veggie(
id: 26,
id: 10,
name: 'Grapes',
imageAssetPath: 'assets/images/placeholder.png',
imageAssetPath: 'assets/images/grape.jpg',
category: VeggieCategory.berry,
shortDescription: 'Couldn\'t have wine without them.',
accentColor: 0xff206010,
accentColor: Color(0x40ac708a),
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,
id: 11,
name: 'Green Pepper',
imageAssetPath: 'assets/images/green_bell_pepper.jpg',
category: VeggieCategory.stealthFruit,
shortDescription: 'Pleasantly bitter, like a sad movie.',
accentColor: Color(0x408eb332),
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],
id: 12,
name: 'Habanero',
imageAssetPath: 'assets/images/habanero.jpg',
category: VeggieCategory.stealthFruit,
shortDescription: 'Delicious... in extremely small quantities.',
accentColor: Color(0x40ff7a01),
seasons: [Season.autumn, Season.summer],
),
Veggie(
id: 29,
id: 13,
name: 'Kale',
imageAssetPath: 'assets/images/placeholder.png',
imageAssetPath: 'assets/images/kale.jpg',
category: VeggieCategory.cruciferous,
shortDescription: 'The meanest vegetable. Does not want to be eaten.',
accentColor: 0xff206010,
accentColor: Color(0x40a86bd8),
seasons: [Season.winter, Season.autumn],
),
Veggie(
id: 30,
id: 14,
name: 'Kiwi',
imageAssetPath: 'assets/images/placeholder.png',
imageAssetPath: 'assets/images/kiwi.jpg',
category: VeggieCategory.berry,
shortDescription: 'Also known as Chinese gooseberry.',
accentColor: 0xff206010,
accentColor: Color(0x40b47b37),
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,
id: 15,
name: 'Lemons',
imageAssetPath: 'assets/images/placeholder.png',
imageAssetPath: 'assets/images/lemon.jpg',
category: VeggieCategory.citrus,
shortDescription: 'Similar to limes, only yellow.',
accentColor: 0xff206010,
seasons: [
Season.winter,
],
accentColor: Color(0x40e2a500),
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],
id: 16,
name: 'Limes',
imageAssetPath: 'assets/images/lime.jpg',
category: VeggieCategory.citrus,
shortDescription: 'Couldn\'t have ceviche and margaritas without them.',
accentColor: Color(0x4089b733),
seasons: [Season.winter],
),
Veggie(
id: 35,
id: 17,
name: 'Mangos',
imageAssetPath: 'assets/images/placeholder.png',
imageAssetPath: 'assets/images/mango.jpg',
category: VeggieCategory.tropical,
shortDescription:
'Bright orange fruit popular with smoothie enthusiasts.',
accentColor: 0xff206010,
shortDescription: 'A fun orange fruit popular with smoothie enthusiasts.',
accentColor: Color(0x40fcc93c),
seasons: [Season.summer, Season.autumn],
),
Veggie(
id: 36,
id: 18,
name: 'Mushrooms',
imageAssetPath: 'assets/images/placeholder.png',
imageAssetPath: 'assets/images/mushroom.jpg',
category: VeggieCategory.fungus,
shortDescription:
'They\'re not truffles, but they\'re still pretty good.',
accentColor: 0xff206010,
shortDescription: 'They\'re not truffles, but they\'re still tasty.',
accentColor: Color(0x40ba754b),
seasons: [Season.spring, Season.autumn],
),
Veggie(
id: 37,
id: 19,
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',
imageAssetPath: 'assets/images/nectarine.jpg',
category: VeggieCategory.stoneFruit,
shortDescription: 'Number one fruit for cobbler.',
accentColor: 0xff206010,
shortDescription: 'Tiny, bald peaches.',
accentColor: Color(0x40e45b3b),
seasons: [Season.summer],
),
Veggie(
id: 43,
name: 'Pears',
imageAssetPath: 'assets/images/placeholder.png',
id: 20,
name: 'Persimmons',
imageAssetPath: 'assets/images/persimmon.jpg',
category: VeggieCategory.fruit,
shortDescription: 'Similar to apples, but gentler and prone to bruising.',
accentColor: 0xff206010,
shortDescription: 'It\'s like a plum and an apple had a baby together.',
accentColor: Color(0x40979852),
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,
id: 21,
name: 'Plums',
imageAssetPath: 'assets/images/placeholder.png',
imageAssetPath: 'assets/images/plum.jpg',
category: VeggieCategory.stoneFruit,
shortDescription: 'Popular in fruit salads and children\'s tales.',
accentColor: 0xff206010,
accentColor: Color(0x40e48b47),
seasons: [Season.summer],
),
Veggie(
id: 47,
id: 22,
name: 'Potatoes',
imageAssetPath: 'assets/images/placeholder.png',
imageAssetPath: 'assets/images/potato.jpg',
category: VeggieCategory.tuber,
shortDescription: 'King of starches and giver of french fries.',
accentColor: 0xff206010,
accentColor: Color(0x40c65c63),
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],
id: 23,
name: 'Radicchio',
imageAssetPath: 'assets/images/radicchio.jpg',
category: VeggieCategory.leafy,
shortDescription: 'It\'s that bitter taste in the salad you\'re eating.',
accentColor: Color(0x40d75875),
seasons: [Season.autumn, Season.spring],
),
Veggie(
id: 49,
id: 24,
name: 'Radishes',
imageAssetPath: 'assets/images/placeholder.png',
imageAssetPath: 'assets/images/radish.jpg',
category: VeggieCategory.root,
shortDescription: 'Try roasting them in addition to slicing them up raw.',
accentColor: 0xff206010,
accentColor: Color(0x40819e4e),
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,
id: 25,
name: 'Squash',
imageAssetPath: 'assets/images/squash.jpg',
category: VeggieCategory.gourd,
shortDescription: 'Bigger and heartier than summer squashes.',
accentColor: Color(0x40dbb721),
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,
id: 26,
name: 'Strawberries',
imageAssetPath: 'assets/images/placeholder.png',
imageAssetPath: 'assets/images/strawberry.jpg',
category: VeggieCategory.berry,
shortDescription:
'A delicious fruit that keeps its seeds on the outside.',
accentColor: 0xff206010,
accentColor: Color(0x40f06a44),
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,
id: 27,
name: 'Tangelo',
imageAssetPath: 'assets/images/tangelo.jpg',
category: VeggieCategory.citrus,
shortDescription: 'No one\'s sure what they are or where they came from.',
accentColor: Color(0x40f88c06),
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,
id: 28,
name: 'Tomatoes',
imageAssetPath: 'assets/images/placeholder.png',
imageAssetPath: 'assets/images/tomato.jpg',
category: VeggieCategory.stealthFruit,
shortDescription: 'A new world food with old world tradition.',
accentColor: 0xff206010,
accentColor: Color(0x40ea3628),
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,
id: 29,
name: 'Watermelon',
imageAssetPath: 'assets/images/placeholder.png',
imageAssetPath: 'assets/images/watermelon.jpg',
category: VeggieCategory.melon,
shortDescription: 'Everyone\'s favorite closing act at the picnic.',
accentColor: 0xff206010,
accentColor: Color(0x40fa8c75),
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],
id: 30,
name: 'Orange Bell Pepper',
imageAssetPath: 'assets/images/orange_bell_pepper.jpg',
category: VeggieCategory.stealthFruit,
shortDescription: 'Like green pepper, but nicer.',
accentColor: Color(0x40fd8e00),
seasons: [Season.summer],
),
];
}

@ -11,60 +11,60 @@ import 'package:shared_preferences/shared_preferences.dart';
/// A model class that mirrors the options in [SettingsScreen] and stores data
/// in shared preferences.
class Preferences extends Model {
Preferences() {
_loadingFuture = _load();
}
// Keys to use with shared preferences.
static const _caloriesKey = 'calories';
static const _preferredCategoriesKey = 'preferredCategories';
// Indicates whether a call to [_load] is in progress;
Future<void> _loadingFuture;
// Indicates whether a call to [_loadFromSharedPrefs] is in progress;
Future<void> _loading;
int _desiredCalories = 2000;
Set<VeggieCategory> _preferredCategories = Set<VeggieCategory>();
Future<int> get desiredCalories async {
await _loadingFuture;
await _loading;
return _desiredCalories;
}
Future<Set<VeggieCategory>> get preferredCategories async {
await _loadingFuture;
await _loading;
return Set.from(_preferredCategories);
}
void addPreferredCategory(VeggieCategory category) {
void addPreferredCategory(VeggieCategory category) async {
_preferredCategories.add(category);
_save();
await _saveToSharedPrefs();
notifyListeners();
}
void removePreferredCategory(VeggieCategory category) {
void removePreferredCategory(VeggieCategory category) async {
_preferredCategories.remove(category);
_save();
await _saveToSharedPrefs();
notifyListeners();
}
void setDesiredCalories(int calories) {
void setDesiredCalories(int calories) async {
_desiredCalories = calories;
_save();
await _saveToSharedPrefs();
notifyListeners();
}
Future<void> _save() async {
void load() {
_loading = _loadFromSharedPrefs();
}
Future<void> _saveToSharedPrefs() async {
final prefs = await SharedPreferences.getInstance();
prefs.setInt(_caloriesKey, _desiredCalories);
await prefs.setInt(_caloriesKey, _desiredCalories);
// Store preferred categories as a comma-separated string containing their
// indices.
prefs.setString(_preferredCategoriesKey,
await prefs.setString(_preferredCategoriesKey,
_preferredCategories.map((c) => c.index.toString()).join(','));
}
Future<void> _load() async {
Future<void> _loadFromSharedPrefs() async {
final prefs = await SharedPreferences.getInstance();
_desiredCalories = prefs.getInt(_caloriesKey) ?? 2000;
_preferredCategories.clear();

@ -2,25 +2,27 @@
// 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:meta/meta.dart';
enum VeggieCategory {
legume,
tuber,
allium,
berry,
citrus,
cruciferous,
fern,
flower,
fruit,
fungus,
gourd,
leafy,
berry,
stealthFruit,
tropical,
fruit,
legume,
melon,
stoneFruit,
fern,
citrus,
root,
allium,
fungus,
stealthFruit,
stoneFruit,
tropical,
tuber,
vegetable,
}
@ -31,23 +33,24 @@ enum Season {
autumn,
}
final Map<VeggieCategory, String> veggieCategoryNames = {
VeggieCategory.legume: 'Legume',
VeggieCategory.tuber: 'Tuber',
const Map<VeggieCategory, String> veggieCategoryNames = {
VeggieCategory.allium: 'Allium',
VeggieCategory.berry: 'Berry',
VeggieCategory.citrus: 'Citrus',
VeggieCategory.cruciferous: 'Cruciferous',
VeggieCategory.fern: 'Technically a fern',
VeggieCategory.flower: 'Flower',
VeggieCategory.fruit: 'Fruit',
VeggieCategory.fungus: 'Fungus',
VeggieCategory.gourd: 'Gourd',
VeggieCategory.leafy: 'Leafy',
VeggieCategory.berry: 'Berry',
VeggieCategory.stealthFruit: 'Stealth fruit',
VeggieCategory.tropical: 'Tropical',
VeggieCategory.fruit: 'Fruit',
VeggieCategory.legume: 'Legume',
VeggieCategory.melon: 'Melon',
VeggieCategory.stoneFruit: 'Stone fruit',
VeggieCategory.fern: 'Technically fern',
VeggieCategory.citrus: 'Citrus',
VeggieCategory.root: 'Root vegetable',
VeggieCategory.allium: 'Allium',
VeggieCategory.fungus: 'Fungus',
VeggieCategory.stealthFruit: 'Stealth fruit',
VeggieCategory.stoneFruit: 'Stone fruit',
VeggieCategory.tropical: 'Tropical',
VeggieCategory.tuber: 'Tuber',
VeggieCategory.vegetable: 'Vegetable',
};
@ -77,7 +80,7 @@ class Veggie {
/// A color value to use when constructing UI elements to match the image
/// found at [imageAssetPath].
final int accentColor;
final Color accentColor;
/// Seasons during which a veggie is harvested.
final List<Season> seasons;
@ -85,4 +88,6 @@ class Veggie {
/// Whether or not the veggie has been saved to the user's garden (i.e. marked
/// as a favorite).
bool isFavorite;
String get categoryName => veggieCategoryNames[category];
}

@ -5,7 +5,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/data/app_state.dart';
import 'package:veggieseasons/data/preferences.dart';
import 'package:veggieseasons/screens/home.dart';
import 'package:veggieseasons/styles.dart';
@ -18,9 +19,12 @@ void main() {
runApp(
ScopedModel<AppState>(
model: AppState(),
child: CupertinoApp(
color: Styles.appBackground,
home: HomeScreen(),
child: ScopedModel<Preferences>(
model: Preferences()..load(),
child: CupertinoApp(
color: Styles.appBackground,
home: HomeScreen(),
),
),
),
);

@ -5,7 +5,7 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/widgets.dart';
import 'package:scoped_model/scoped_model.dart';
import 'package:veggieseasons/data/model.dart';
import 'package:veggieseasons/data/app_state.dart';
import 'package:veggieseasons/data/veggie.dart';
import 'package:veggieseasons/styles.dart';

@ -5,7 +5,7 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/widgets.dart';
import 'package:scoped_model/scoped_model.dart';
import 'package:veggieseasons/data/model.dart';
import 'package:veggieseasons/data/app_state.dart';
import 'package:veggieseasons/data/veggie.dart';
import 'package:veggieseasons/styles.dart';
import 'package:veggieseasons/widgets/veggie_headline.dart';

@ -6,19 +6,25 @@ 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/app_state.dart';
import 'package:veggieseasons/data/preferences.dart';
import 'package:veggieseasons/data/veggie.dart';
import 'package:veggieseasons/styles.dart';
import 'package:veggieseasons/widgets/veggie_headline.dart';
import 'package:veggieseasons/widgets/veggie_card.dart';
class ListScreen extends StatelessWidget {
List<Widget> _generateVeggieRows(List<Veggie> veggies) {
List<Widget> _generateVeggieRows(List<Veggie> veggies, Preferences prefs) {
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),
child: FutureBuilder<Set<VeggieCategory>>(
future: prefs.preferredCategories,
builder: (context, snapshot) {
final data = snapshot.data ?? Set<VeggieCategory>();
return VeggieCard(veggie, data.contains(veggie.category));
}),
));
}
@ -29,8 +35,11 @@ class ListScreen extends StatelessWidget {
Widget build(BuildContext context) {
return CupertinoTabView(
builder: (context) {
String dateString = DateFormat.yMMMMd("en_US").format(DateTime.now());
final model = ScopedModel.of<AppState>(context, rebuildOnChange: true);
String dateString = DateFormat.jms("en_US").format(DateTime.now());
final appState =
ScopedModel.of<AppState>(context, rebuildOnChange: true);
final prefs =
ScopedModel.of<Preferences>(context, rebuildOnChange: true);
final rows = <Widget>[];
@ -47,7 +56,7 @@ class ListScreen extends StatelessWidget {
),
);
rows.addAll(_generateVeggieRows(model.availableVeggies));
rows.addAll(_generateVeggieRows(appState.availableVeggies, prefs));
rows.add(
Padding(
@ -56,7 +65,7 @@ class ListScreen extends StatelessWidget {
),
);
rows.addAll(_generateVeggieRows(model.unavailableVeggies));
rows.addAll(_generateVeggieRows(appState.unavailableVeggies, prefs));
return DecoratedBox(
decoration: BoxDecoration(color: Color(0xffffffff)),

@ -5,7 +5,7 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/widgets.dart';
import 'package:scoped_model/scoped_model.dart';
import 'package:veggieseasons/data/model.dart';
import 'package:veggieseasons/data/app_state.dart';
import 'package:veggieseasons/data/veggie.dart';
import 'package:veggieseasons/styles.dart';
import 'package:veggieseasons/widgets/search_bar.dart';

@ -7,8 +7,6 @@ import 'package:flutter/widgets.dart';
import 'package:veggieseasons/data/veggie.dart';
abstract class Styles {
static String createHeroTag(Veggie veggie) => 'veggie_hero_${veggie.name}';
static const headlineText = TextStyle(
color: Color.fromRGBO(0, 0, 0, 0.8),
fontFamily: 'NotoSans',

@ -0,0 +1,77 @@
// 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/screens/details.dart';
import 'package:veggieseasons/styles.dart';
class VeggieCard extends StatelessWidget {
VeggieCard(this.veggie, this.isPreferredCategory);
/// Veggie to be displayed by the card.
final Veggie veggie;
/// Whether [veggie] falls into one of user's preferred [VeggieCategory]s
final bool isPreferredCategory;
List<Widget> _buildStackChildren() {
final widgets = <Widget>[];
widgets.add(Hero(
tag: veggie.id,
child: Image.asset(
veggie.imageAssetPath,
fit: BoxFit.cover,
),
));
widgets.add(Positioned(
bottom: 0.0,
left: 0.0,
right: 0.0,
child: DecoratedBox(
decoration: BoxDecoration(
color: veggie.accentColor,
),
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
veggie.name,
style: Styles.cardTitleText,
),
Text(
veggie.shortDescription,
style: Styles.cardDescriptionText,
),
],
),
),
),
));
return widgets;
}
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () {
Navigator.of(context).push(CupertinoPageRoute(
builder: (context) => DetailsScreen(veggie.id),
fullscreenDialog: true,
));
},
child: ClipRRect(
borderRadius: BorderRadius.circular(10.0),
child: Stack(
children: _buildStackChildren(),
),
),
);
}
}

@ -12,7 +12,7 @@ dependencies:
cupertino_icons: ^0.1.2
intl: ^0.15.7
scoped_model: ^0.3.0
scoped_model: ^1.0.1
shared_preferences: ^0.4.3
dev_dependencies:
@ -20,18 +20,49 @@ dev_dependencies:
sdk: flutter
flutter:
assets:
- assets/images/placeholder.png
- assets/images/apple.jpg
- assets/images/artichoke.jpg
- assets/images/asparagus.jpg
- assets/images/avocado.jpg
- assets/images/blackberry.jpg
- assets/images/canteloupe.jpg
- assets/images/cauliflower.jpg
- assets/images/endive.jpg
- assets/images/fig.jpg
- assets/images/grape.jpg
- assets/images/green_bell_pepper.jpg
- assets/images/habanero.jpg
- assets/images/kale.jpg
- assets/images/kiwi.jpg
- assets/images/lemon.jpg
- assets/images/lime.jpg
- assets/images/mango.jpg
- assets/images/mushroom.jpg
- assets/images/nectarine.jpg
- assets/images/persimmon.jpg
- assets/images/plum.jpg
- assets/images/potato.jpg
- assets/images/radicchio.jpg
- assets/images/radish.jpg
- assets/images/squash.jpg
- assets/images/strawberry.jpg
- assets/images/tangelo.jpg
- assets/images/tomato.jpg
- assets/images/watermelon.jpg
- assets/images/orange_bell_pepper.jpg
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
- 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