mirror of
https://github.com/flutter/samples.git
synced 2025-11-08 13:58:47 +00:00
Upgrading samples to flutter_lints, part 1 of n (#804)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
include: package:pedantic/analysis_options.1.9.0.yaml
|
||||
include: package:flutter_lints/flutter.yaml
|
||||
|
||||
analyzer:
|
||||
strong-mode:
|
||||
@@ -7,25 +7,14 @@ analyzer:
|
||||
|
||||
linter:
|
||||
rules:
|
||||
- avoid_types_on_closure_parameters
|
||||
- avoid_void_async
|
||||
- await_only_futures
|
||||
- camel_case_types
|
||||
- cancel_subscriptions
|
||||
- close_sinks
|
||||
- constant_identifier_names
|
||||
- control_flow_in_finally
|
||||
- directives_ordering
|
||||
- empty_statements
|
||||
- hash_and_equals
|
||||
- implementation_imports
|
||||
- non_constant_identifier_names
|
||||
- package_api_docs
|
||||
- package_names
|
||||
- package_prefixed_library_names
|
||||
- test_types_in_equals
|
||||
- throw_in_finally
|
||||
- unnecessary_brace_in_string_interps
|
||||
- unnecessary_getters_setters
|
||||
- unnecessary_new
|
||||
- unnecessary_statements
|
||||
avoid_types_on_closure_parameters: true
|
||||
avoid_void_async: true
|
||||
cancel_subscriptions: true
|
||||
close_sinks: true
|
||||
directives_ordering: true
|
||||
package_api_docs: true
|
||||
package_prefixed_library_names: true
|
||||
test_types_in_equals: true
|
||||
throw_in_finally: true
|
||||
unnecessary_statements: true
|
||||
use_key_in_widget_constructors: false
|
||||
|
||||
@@ -13,13 +13,13 @@ class LocalVeggieProvider {
|
||||
imageAssetPath: 'assets/images/apple.jpg',
|
||||
category: VeggieCategory.fruit,
|
||||
shortDescription: 'Green or red, they\'re generally round and tasty.',
|
||||
accentColor: Color(0x40de8c66),
|
||||
accentColor: const Color(0x40de8c66),
|
||||
seasons: [Season.winter, Season.spring, Season.summer, Season.autumn],
|
||||
vitaminAPercentage: 2,
|
||||
vitaminCPercentage: 8,
|
||||
servingSize: 'One large apple',
|
||||
caloriesPerServing: 130,
|
||||
trivia: [
|
||||
trivia: const [
|
||||
Trivia(
|
||||
'A peck of apples (that\'s a real unit of mesaurement!) weighs approximately how many pounds?',
|
||||
[
|
||||
@@ -91,13 +91,13 @@ class LocalVeggieProvider {
|
||||
imageAssetPath: 'assets/images/artichoke.jpg',
|
||||
category: VeggieCategory.flower,
|
||||
shortDescription: 'The armadillo of vegetables.',
|
||||
accentColor: Color(0x408ea26d),
|
||||
accentColor: const Color(0x408ea26d),
|
||||
seasons: [Season.spring, Season.autumn],
|
||||
vitaminAPercentage: 0,
|
||||
vitaminCPercentage: 25,
|
||||
servingSize: '1 medium artichoke',
|
||||
caloriesPerServing: 60,
|
||||
trivia: [
|
||||
trivia: const [
|
||||
Trivia(
|
||||
'Artichokes are which part of the plant?',
|
||||
[
|
||||
@@ -142,13 +142,13 @@ class LocalVeggieProvider {
|
||||
imageAssetPath: 'assets/images/asparagus.jpg',
|
||||
category: VeggieCategory.fern,
|
||||
shortDescription: 'It\'s been used a food and medicine for millenia.',
|
||||
accentColor: Color(0x408cb437),
|
||||
accentColor: const Color(0x408cb437),
|
||||
seasons: [Season.spring],
|
||||
vitaminAPercentage: 10,
|
||||
vitaminCPercentage: 15,
|
||||
servingSize: '5 spears',
|
||||
caloriesPerServing: 20,
|
||||
trivia: [
|
||||
trivia: const [
|
||||
Trivia(
|
||||
'The nodules at the tip of an asparagus spear are actually which part of the plant?',
|
||||
[
|
||||
@@ -193,13 +193,13 @@ class LocalVeggieProvider {
|
||||
imageAssetPath: 'assets/images/avocado.jpg',
|
||||
category: VeggieCategory.stealthFruit,
|
||||
shortDescription: 'One of the oiliest, richest fruits money can buy.',
|
||||
accentColor: Color(0x40b0ba59),
|
||||
accentColor: const Color(0x40b0ba59),
|
||||
seasons: [Season.winter, Season.spring, Season.summer],
|
||||
vitaminAPercentage: 0,
|
||||
vitaminCPercentage: 4,
|
||||
servingSize: '1/5 medium avocado',
|
||||
caloriesPerServing: 50,
|
||||
trivia: [
|
||||
trivia: const [
|
||||
Trivia(
|
||||
'What\'s the most popular variety of avocado?',
|
||||
[
|
||||
@@ -244,13 +244,13 @@ class LocalVeggieProvider {
|
||||
imageAssetPath: 'assets/images/blackberry.jpg',
|
||||
category: VeggieCategory.berry,
|
||||
shortDescription: 'Find them on backroads and fences in the Northwest.',
|
||||
accentColor: Color(0x409d5adb),
|
||||
accentColor: const Color(0x409d5adb),
|
||||
seasons: [Season.summer],
|
||||
vitaminAPercentage: 6,
|
||||
vitaminCPercentage: 4,
|
||||
servingSize: '1 cup',
|
||||
caloriesPerServing: 62,
|
||||
trivia: [
|
||||
trivia: const [
|
||||
Trivia(
|
||||
'What color are unripe blackberries?',
|
||||
[
|
||||
@@ -286,13 +286,13 @@ class LocalVeggieProvider {
|
||||
imageAssetPath: 'assets/images/cantaloupe.jpg',
|
||||
category: VeggieCategory.melon,
|
||||
shortDescription: 'A fruit so tasty there\'s a utensil just for it.',
|
||||
accentColor: Color(0x40f6bd56),
|
||||
accentColor: const Color(0x40f6bd56),
|
||||
seasons: [Season.summer],
|
||||
vitaminAPercentage: 120,
|
||||
vitaminCPercentage: 80,
|
||||
servingSize: '1/4 medium cantaloupe',
|
||||
caloriesPerServing: 50,
|
||||
trivia: [
|
||||
trivia: const [
|
||||
Trivia(
|
||||
'Which of these is another name for cantaloupe?',
|
||||
[
|
||||
@@ -337,13 +337,13 @@ class LocalVeggieProvider {
|
||||
imageAssetPath: 'assets/images/cauliflower.jpg',
|
||||
category: VeggieCategory.cruciferous,
|
||||
shortDescription: 'Looks like white broccoli and explodes when cut.',
|
||||
accentColor: Color(0x40c891a8),
|
||||
accentColor: const Color(0x40c891a8),
|
||||
seasons: [Season.autumn],
|
||||
vitaminAPercentage: 0,
|
||||
vitaminCPercentage: 100,
|
||||
servingSize: '1/6 medium head',
|
||||
caloriesPerServing: 25,
|
||||
trivia: [
|
||||
trivia: const [
|
||||
Trivia(
|
||||
'The quote "Cauliflower is nothing but cabbage with a college education" is attributed to whom?',
|
||||
[
|
||||
@@ -397,13 +397,13 @@ class LocalVeggieProvider {
|
||||
imageAssetPath: 'assets/images/endive.jpg',
|
||||
category: VeggieCategory.leafy,
|
||||
shortDescription: 'It\'s basically the veal of lettuce.',
|
||||
accentColor: Color(0x40c5be53),
|
||||
accentColor: const Color(0x40c5be53),
|
||||
seasons: [Season.winter, Season.spring, Season.autumn],
|
||||
vitaminAPercentage: 10,
|
||||
vitaminCPercentage: 2,
|
||||
servingSize: '1/2 cup, chopped',
|
||||
caloriesPerServing: 4,
|
||||
trivia: [
|
||||
trivia: const [
|
||||
Trivia(
|
||||
'What\'s another name for Belgian endive?',
|
||||
[
|
||||
@@ -439,13 +439,13 @@ class LocalVeggieProvider {
|
||||
imageAssetPath: 'assets/images/fig.jpg',
|
||||
category: VeggieCategory.fruit,
|
||||
shortDescription: 'Delicious when sliced and wrapped in prosciutto.',
|
||||
accentColor: Color(0x40aa6d7c),
|
||||
accentColor: const Color(0x40aa6d7c),
|
||||
seasons: [Season.summer, Season.autumn],
|
||||
vitaminAPercentage: 2,
|
||||
vitaminCPercentage: 2,
|
||||
servingSize: '1 large fig',
|
||||
caloriesPerServing: 50,
|
||||
trivia: [
|
||||
trivia: const [
|
||||
Trivia(
|
||||
'Which of these isn\'t a variety of figs?',
|
||||
[
|
||||
@@ -481,13 +481,13 @@ class LocalVeggieProvider {
|
||||
imageAssetPath: 'assets/images/grape.jpg',
|
||||
category: VeggieCategory.berry,
|
||||
shortDescription: 'Couldn\'t have wine without them.',
|
||||
accentColor: Color(0x40ac708a),
|
||||
accentColor: const Color(0x40ac708a),
|
||||
seasons: [Season.autumn],
|
||||
vitaminAPercentage: 0,
|
||||
vitaminCPercentage: 2,
|
||||
servingSize: '3/4 cup',
|
||||
caloriesPerServing: 90,
|
||||
trivia: [
|
||||
trivia: const [
|
||||
Trivia(
|
||||
'How long ago were grapes introduced to the Americas?',
|
||||
[
|
||||
@@ -532,13 +532,13 @@ class LocalVeggieProvider {
|
||||
imageAssetPath: 'assets/images/green_bell_pepper.jpg',
|
||||
category: VeggieCategory.stealthFruit,
|
||||
shortDescription: 'Pleasantly bitter, like a sad movie.',
|
||||
accentColor: Color(0x408eb332),
|
||||
accentColor: const Color(0x408eb332),
|
||||
seasons: [Season.summer],
|
||||
vitaminAPercentage: 4,
|
||||
vitaminCPercentage: 190,
|
||||
servingSize: '1 medium pepper',
|
||||
caloriesPerServing: 25,
|
||||
trivia: [
|
||||
trivia: const [
|
||||
Trivia(
|
||||
'What\'s the Australian term for a bell pepper?',
|
||||
[
|
||||
@@ -574,13 +574,13 @@ class LocalVeggieProvider {
|
||||
imageAssetPath: 'assets/images/habanero.jpg',
|
||||
category: VeggieCategory.stealthFruit,
|
||||
shortDescription: 'Delicious... in extremely small quantities.',
|
||||
accentColor: Color(0x40ff7a01),
|
||||
accentColor: const Color(0x40ff7a01),
|
||||
seasons: [Season.summer, Season.autumn],
|
||||
vitaminAPercentage: 9,
|
||||
vitaminCPercentage: 100,
|
||||
servingSize: '1 pepper',
|
||||
caloriesPerServing: 20,
|
||||
trivia: [
|
||||
trivia: const [
|
||||
Trivia(
|
||||
'How high can habaneros rate on the Scoville scale?',
|
||||
[
|
||||
@@ -616,13 +616,13 @@ class LocalVeggieProvider {
|
||||
imageAssetPath: 'assets/images/kale.jpg',
|
||||
category: VeggieCategory.cruciferous,
|
||||
shortDescription: 'The meanest vegetable. Does not want to be eaten.',
|
||||
accentColor: Color(0x40a86bd8),
|
||||
accentColor: const Color(0x40a86bd8),
|
||||
seasons: [Season.winter, Season.autumn],
|
||||
vitaminAPercentage: 133,
|
||||
vitaminCPercentage: 134,
|
||||
servingSize: '1 cup, chopped',
|
||||
caloriesPerServing: 33,
|
||||
trivia: [
|
||||
trivia: const [
|
||||
Trivia(
|
||||
'Kale is sweeter when harvested after what?',
|
||||
[
|
||||
@@ -658,13 +658,13 @@ class LocalVeggieProvider {
|
||||
imageAssetPath: 'assets/images/kiwi.jpg',
|
||||
category: VeggieCategory.berry,
|
||||
shortDescription: 'Also known as Chinese gooseberry.',
|
||||
accentColor: Color(0x40b47b37),
|
||||
accentColor: const Color(0x40b47b37),
|
||||
seasons: [Season.summer],
|
||||
vitaminAPercentage: 2,
|
||||
vitaminCPercentage: 240,
|
||||
servingSize: '2 medium kiwis',
|
||||
caloriesPerServing: 90,
|
||||
trivia: [
|
||||
trivia: const [
|
||||
Trivia(
|
||||
'Europeans sometimes refer to kiwi as what?',
|
||||
[
|
||||
@@ -700,13 +700,13 @@ class LocalVeggieProvider {
|
||||
imageAssetPath: 'assets/images/lemon.jpg',
|
||||
category: VeggieCategory.citrus,
|
||||
shortDescription: 'Similar to limes, only yellow.',
|
||||
accentColor: Color(0x40e2a500),
|
||||
accentColor: const Color(0x40e2a500),
|
||||
seasons: [Season.winter],
|
||||
vitaminAPercentage: 0,
|
||||
vitaminCPercentage: 40,
|
||||
servingSize: '1 medium lemon',
|
||||
caloriesPerServing: 15,
|
||||
trivia: [
|
||||
trivia: const [
|
||||
Trivia(
|
||||
'A lemon tree can produce up to how many pounds of fruit each year?',
|
||||
[
|
||||
@@ -751,13 +751,13 @@ class LocalVeggieProvider {
|
||||
imageAssetPath: 'assets/images/lime.jpg',
|
||||
category: VeggieCategory.citrus,
|
||||
shortDescription: 'Couldn\'t have ceviche and margaritas without them.',
|
||||
accentColor: Color(0x4089b733),
|
||||
accentColor: const Color(0x4089b733),
|
||||
seasons: [Season.winter],
|
||||
vitaminAPercentage: 0,
|
||||
vitaminCPercentage: 35,
|
||||
servingSize: '1 medium lime',
|
||||
caloriesPerServing: 20,
|
||||
trivia: [
|
||||
trivia: const [
|
||||
Trivia(
|
||||
'Which American state is famous for its Key Lime Pie?',
|
||||
[
|
||||
@@ -793,13 +793,13 @@ class LocalVeggieProvider {
|
||||
imageAssetPath: 'assets/images/mango.jpg',
|
||||
category: VeggieCategory.tropical,
|
||||
shortDescription: 'A fun orange fruit popular with smoothie enthusiasts.',
|
||||
accentColor: Color(0x40fcc93c),
|
||||
accentColor: const Color(0x40fcc93c),
|
||||
seasons: [Season.summer, Season.autumn],
|
||||
vitaminAPercentage: 72,
|
||||
vitaminCPercentage: 203,
|
||||
servingSize: '1 fruit',
|
||||
caloriesPerServing: 201,
|
||||
trivia: [
|
||||
trivia: const [
|
||||
Trivia(
|
||||
'In Mexico, mangos are frequently dusted with what spices before being eaten as a snack?',
|
||||
[
|
||||
@@ -835,13 +835,13 @@ class LocalVeggieProvider {
|
||||
imageAssetPath: 'assets/images/mushroom.jpg',
|
||||
category: VeggieCategory.fungus,
|
||||
shortDescription: 'They\'re not truffles, but they\'re still tasty.',
|
||||
accentColor: Color(0x40ba754b),
|
||||
accentColor: const Color(0x40ba754b),
|
||||
seasons: [Season.spring, Season.autumn],
|
||||
vitaminAPercentage: 0,
|
||||
vitaminCPercentage: 2,
|
||||
servingSize: '5 medium \'shrooms',
|
||||
caloriesPerServing: 20,
|
||||
trivia: [
|
||||
trivia: const [
|
||||
Trivia(
|
||||
'Someone who loves eating mushrooms is called what?',
|
||||
[
|
||||
@@ -886,13 +886,13 @@ class LocalVeggieProvider {
|
||||
imageAssetPath: 'assets/images/nectarine.jpg',
|
||||
category: VeggieCategory.stoneFruit,
|
||||
shortDescription: 'Tiny, bald peaches.',
|
||||
accentColor: Color(0x40e45b3b),
|
||||
accentColor: const Color(0x40e45b3b),
|
||||
seasons: [Season.summer],
|
||||
vitaminAPercentage: 8,
|
||||
vitaminCPercentage: 15,
|
||||
servingSize: '1 medium nectarine',
|
||||
caloriesPerServing: 60,
|
||||
trivia: [
|
||||
trivia: const [
|
||||
Trivia(
|
||||
'Nectarines are technically a variety of which other fruit?',
|
||||
[
|
||||
@@ -928,13 +928,13 @@ class LocalVeggieProvider {
|
||||
imageAssetPath: 'assets/images/persimmon.jpg',
|
||||
category: VeggieCategory.fruit,
|
||||
shortDescription: 'It\'s like a plum and an apple had a baby together.',
|
||||
accentColor: Color(0x40979852),
|
||||
accentColor: const Color(0x40979852),
|
||||
seasons: [Season.winter, Season.autumn],
|
||||
vitaminAPercentage: 0,
|
||||
vitaminCPercentage: 27,
|
||||
servingSize: '1 fruit',
|
||||
caloriesPerServing: 32,
|
||||
trivia: [
|
||||
trivia: const [
|
||||
Trivia(
|
||||
'What\'s the most commonly grown variety of persimmon?',
|
||||
[
|
||||
@@ -970,13 +970,13 @@ class LocalVeggieProvider {
|
||||
imageAssetPath: 'assets/images/plum.jpg',
|
||||
category: VeggieCategory.stoneFruit,
|
||||
shortDescription: 'Popular in fruit salads and children\'s tales.',
|
||||
accentColor: Color(0x40e48b47),
|
||||
accentColor: const Color(0x40e48b47),
|
||||
seasons: [Season.summer],
|
||||
vitaminAPercentage: 8,
|
||||
vitaminCPercentage: 10,
|
||||
servingSize: '2 medium plums',
|
||||
caloriesPerServing: 70,
|
||||
trivia: [
|
||||
trivia: const [
|
||||
Trivia(
|
||||
'Plums should be handled with care because...?',
|
||||
[
|
||||
@@ -1012,13 +1012,13 @@ class LocalVeggieProvider {
|
||||
imageAssetPath: 'assets/images/potato.jpg',
|
||||
category: VeggieCategory.tuber,
|
||||
shortDescription: 'King of starches and giver of french fries.',
|
||||
accentColor: Color(0x40c65c63),
|
||||
accentColor: const Color(0x40c65c63),
|
||||
seasons: [Season.winter, Season.autumn],
|
||||
vitaminAPercentage: 0,
|
||||
vitaminCPercentage: 45,
|
||||
servingSize: '1 medium spud',
|
||||
caloriesPerServing: 110,
|
||||
trivia: [
|
||||
trivia: const [
|
||||
Trivia(
|
||||
'Which country consumes the most fried potatoes per capita?',
|
||||
[
|
||||
@@ -1054,13 +1054,13 @@ class LocalVeggieProvider {
|
||||
imageAssetPath: 'assets/images/radicchio.jpg',
|
||||
category: VeggieCategory.leafy,
|
||||
shortDescription: 'It\'s that bitter taste in the salad you\'re eating.',
|
||||
accentColor: Color(0x40d75875),
|
||||
accentColor: const Color(0x40d75875),
|
||||
seasons: [Season.spring, Season.autumn],
|
||||
vitaminAPercentage: 0,
|
||||
vitaminCPercentage: 10,
|
||||
servingSize: '2 cups shredded',
|
||||
caloriesPerServing: 20,
|
||||
trivia: [
|
||||
trivia: const [
|
||||
Trivia(
|
||||
'Radicchio is a particuarly good source of which mineral?',
|
||||
[
|
||||
@@ -1096,13 +1096,13 @@ class LocalVeggieProvider {
|
||||
imageAssetPath: 'assets/images/radish.jpg',
|
||||
category: VeggieCategory.root,
|
||||
shortDescription: 'Try roasting them in addition to slicing them up raw.',
|
||||
accentColor: Color(0x40819e4e),
|
||||
accentColor: const Color(0x40819e4e),
|
||||
seasons: [Season.spring, Season.autumn],
|
||||
vitaminAPercentage: 0,
|
||||
vitaminCPercentage: 30,
|
||||
servingSize: '7 radishes',
|
||||
caloriesPerServing: 10,
|
||||
trivia: [
|
||||
trivia: const [
|
||||
Trivia(
|
||||
'Which ancient civilization is known to have used radish oil?',
|
||||
[
|
||||
@@ -1138,13 +1138,13 @@ class LocalVeggieProvider {
|
||||
imageAssetPath: 'assets/images/squash.jpg',
|
||||
category: VeggieCategory.gourd,
|
||||
shortDescription: 'Just slather them in butter and pop \'em in the oven.',
|
||||
accentColor: Color(0x40dbb721),
|
||||
accentColor: const Color(0x40dbb721),
|
||||
seasons: [Season.winter, Season.autumn],
|
||||
vitaminAPercentage: 297,
|
||||
vitaminCPercentage: 48,
|
||||
servingSize: '1 cup diced butternut',
|
||||
caloriesPerServing: 63,
|
||||
trivia: [
|
||||
trivia: const [
|
||||
Trivia(
|
||||
'Which of these is not a type of squash?',
|
||||
[
|
||||
@@ -1181,13 +1181,13 @@ class LocalVeggieProvider {
|
||||
category: VeggieCategory.berry,
|
||||
shortDescription:
|
||||
'A delicious fruit that keeps its seeds on the outside.',
|
||||
accentColor: Color(0x40f06a44),
|
||||
accentColor: const Color(0x40f06a44),
|
||||
seasons: [Season.spring, Season.summer],
|
||||
vitaminAPercentage: 0,
|
||||
vitaminCPercentage: 160,
|
||||
servingSize: '8 medium strawberries',
|
||||
caloriesPerServing: 50,
|
||||
trivia: [
|
||||
trivia: const [
|
||||
Trivia(
|
||||
'How many seeds are in the average strawberry?',
|
||||
[
|
||||
@@ -1223,13 +1223,13 @@ class LocalVeggieProvider {
|
||||
imageAssetPath: 'assets/images/tangelo.jpg',
|
||||
category: VeggieCategory.citrus,
|
||||
shortDescription: 'No one\'s sure what they are or where they came from.',
|
||||
accentColor: Color(0x40f88c06),
|
||||
accentColor: const Color(0x40f88c06),
|
||||
seasons: [Season.winter, Season.autumn],
|
||||
vitaminAPercentage: 6,
|
||||
vitaminCPercentage: 181,
|
||||
servingSize: '1 medium tangelo',
|
||||
caloriesPerServing: 60,
|
||||
trivia: [
|
||||
trivia: const [
|
||||
Trivia(
|
||||
'The tangelo is thought to be a cross between oranges and which other fruit?',
|
||||
[
|
||||
@@ -1265,13 +1265,13 @@ class LocalVeggieProvider {
|
||||
imageAssetPath: 'assets/images/tomato.jpg',
|
||||
category: VeggieCategory.stealthFruit,
|
||||
shortDescription: 'A new world food with old world tradition.',
|
||||
accentColor: Color(0x40ea3628),
|
||||
accentColor: const Color(0x40ea3628),
|
||||
seasons: [Season.summer],
|
||||
vitaminAPercentage: 20,
|
||||
vitaminCPercentage: 40,
|
||||
servingSize: '1 medium tomato',
|
||||
caloriesPerServing: 25,
|
||||
trivia: [
|
||||
trivia: const [
|
||||
Trivia(
|
||||
'French speakers sometimes refer to tomatoes with which name?',
|
||||
[
|
||||
@@ -1307,13 +1307,13 @@ class LocalVeggieProvider {
|
||||
imageAssetPath: 'assets/images/watermelon.jpg',
|
||||
category: VeggieCategory.melon,
|
||||
shortDescription: 'Everyone\'s favorite closing act at the picnic.',
|
||||
accentColor: Color(0x40fa8c75),
|
||||
accentColor: const Color(0x40fa8c75),
|
||||
seasons: [Season.summer],
|
||||
vitaminAPercentage: 30,
|
||||
vitaminCPercentage: 25,
|
||||
servingSize: '2 cups diced',
|
||||
caloriesPerServing: 80,
|
||||
trivia: [
|
||||
trivia: const [
|
||||
Trivia(
|
||||
'How much of a watermelon is water?',
|
||||
[
|
||||
@@ -1358,13 +1358,13 @@ class LocalVeggieProvider {
|
||||
imageAssetPath: 'assets/images/orange_bell_pepper.jpg',
|
||||
category: VeggieCategory.stealthFruit,
|
||||
shortDescription: 'Like green pepper, but nicer.',
|
||||
accentColor: Color(0x40fd8e00),
|
||||
accentColor: const Color(0x40fd8e00),
|
||||
seasons: [Season.summer],
|
||||
vitaminAPercentage: 4,
|
||||
vitaminCPercentage: 190,
|
||||
servingSize: '1 medium pepper',
|
||||
caloriesPerServing: 25,
|
||||
trivia: [
|
||||
trivia: const [
|
||||
Trivia(
|
||||
'Which compound (not found in bell peppers) is responsible for many peppers\' spicy taste?',
|
||||
[
|
||||
|
||||
@@ -61,7 +61,7 @@ class _VeggieAppState extends State<VeggieApp> with RestorationMixin {
|
||||
child: CupertinoApp(
|
||||
theme: Styles.veggieThemeData,
|
||||
debugShowCheckedModeBanner: false,
|
||||
home: HomeScreen(restorationId: 'home'),
|
||||
home: const HomeScreen(restorationId: 'home'),
|
||||
restorationScopeId: 'app',
|
||||
),
|
||||
);
|
||||
|
||||
@@ -43,7 +43,7 @@ class ServingInfoChart extends StatelessWidget {
|
||||
final themeData = CupertinoTheme.of(context);
|
||||
return Column(
|
||||
children: [
|
||||
SizedBox(height: 16),
|
||||
const SizedBox(height: 16),
|
||||
Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Padding(
|
||||
@@ -187,9 +187,9 @@ class InfoView extends StatelessWidget {
|
||||
);
|
||||
},
|
||||
),
|
||||
Spacer(),
|
||||
const Spacer(),
|
||||
for (Season season in veggie.seasons) ...[
|
||||
SizedBox(width: 12),
|
||||
const SizedBox(width: 12),
|
||||
Padding(
|
||||
padding: Styles.seasonIconPadding[season],
|
||||
child: Icon(
|
||||
@@ -201,18 +201,18 @@ class InfoView extends StatelessWidget {
|
||||
],
|
||||
],
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
veggie.name,
|
||||
style: Styles.detailsTitleText(themeData),
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
veggie.shortDescription,
|
||||
style: CupertinoTheme.of(context).textTheme.textStyle,
|
||||
),
|
||||
ServingInfoChart(veggie, prefs),
|
||||
SizedBox(height: 24),
|
||||
const SizedBox(height: 24),
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
@@ -222,7 +222,7 @@ class InfoView extends StatelessWidget {
|
||||
appState.setFavorite(id, value);
|
||||
},
|
||||
),
|
||||
SizedBox(width: 8),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
'Save to Garden',
|
||||
style: CupertinoTheme.of(context).textTheme.textStyle,
|
||||
@@ -239,7 +239,7 @@ class DetailsScreen extends StatefulWidget {
|
||||
final int id;
|
||||
final String restorationId;
|
||||
|
||||
DetailsScreen({this.id, this.restorationId});
|
||||
const DetailsScreen({this.id, this.restorationId});
|
||||
|
||||
static String show(NavigatorState navigator, int veggieId) {
|
||||
return navigator.restorablePush<void>(_routeBuilder, arguments: veggieId);
|
||||
@@ -321,9 +321,9 @@ class _DetailsScreenState extends State<DetailsScreen> with RestorationMixin {
|
||||
restorationId: 'list',
|
||||
children: [
|
||||
_buildHeader(context, appState),
|
||||
SizedBox(height: 20),
|
||||
const SizedBox(height: 20),
|
||||
CupertinoSegmentedControl<int>(
|
||||
children: {
|
||||
children: const {
|
||||
0: Text(
|
||||
'Facts & Info',
|
||||
),
|
||||
|
||||
@@ -10,7 +10,7 @@ import 'package:veggieseasons/data/veggie.dart';
|
||||
import 'package:veggieseasons/widgets/veggie_headline.dart';
|
||||
|
||||
class FavoritesScreen extends StatelessWidget {
|
||||
FavoritesScreen({this.restorationId, Key key}) : super(key: key);
|
||||
const FavoritesScreen({this.restorationId, Key key}) : super(key: key);
|
||||
|
||||
final String restorationId;
|
||||
|
||||
@@ -22,7 +22,7 @@ class FavoritesScreen extends StatelessWidget {
|
||||
final model = Provider.of<AppState>(context);
|
||||
|
||||
return CupertinoPageScaffold(
|
||||
navigationBar: CupertinoNavigationBar(
|
||||
navigationBar: const CupertinoNavigationBar(
|
||||
middle: Text('My Garden'),
|
||||
),
|
||||
child: Center(
|
||||
@@ -37,10 +37,10 @@ class FavoritesScreen extends StatelessWidget {
|
||||
: ListView(
|
||||
restorationId: 'list',
|
||||
children: [
|
||||
SizedBox(height: 24),
|
||||
const SizedBox(height: 24),
|
||||
for (Veggie veggie in model.favoriteVeggies)
|
||||
Padding(
|
||||
padding: EdgeInsets.fromLTRB(16, 0, 16, 24),
|
||||
padding: const EdgeInsets.fromLTRB(16, 0, 16, 24),
|
||||
child: VeggieHeadline(veggie),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -10,7 +10,7 @@ import 'package:veggieseasons/screens/search.dart';
|
||||
import 'package:veggieseasons/screens/settings.dart';
|
||||
|
||||
class HomeScreen extends StatelessWidget {
|
||||
HomeScreen({Key key, this.restorationId}) : super(key: key);
|
||||
const HomeScreen({Key key, this.restorationId}) : super(key: key);
|
||||
|
||||
final String restorationId;
|
||||
|
||||
@@ -20,7 +20,7 @@ class HomeScreen extends StatelessWidget {
|
||||
restorationId: restorationId,
|
||||
child: CupertinoTabScaffold(
|
||||
restorationId: 'scaffold',
|
||||
tabBar: CupertinoTabBar(items: [
|
||||
tabBar: CupertinoTabBar(items: const [
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(CupertinoIcons.home),
|
||||
label: 'Home',
|
||||
@@ -40,13 +40,13 @@ class HomeScreen extends StatelessWidget {
|
||||
]),
|
||||
tabBuilder: (context, index) {
|
||||
if (index == 0) {
|
||||
return ListScreen(restorationId: 'list');
|
||||
return const ListScreen(restorationId: 'list');
|
||||
} else if (index == 1) {
|
||||
return FavoritesScreen(restorationId: 'favorites');
|
||||
return const FavoritesScreen(restorationId: 'favorites');
|
||||
} else if (index == 2) {
|
||||
return SearchScreen(restorationId: 'search');
|
||||
return const SearchScreen(restorationId: 'search');
|
||||
} else {
|
||||
return SettingsScreen(restorationId: 'settings');
|
||||
return const SettingsScreen(restorationId: 'settings');
|
||||
}
|
||||
},
|
||||
),
|
||||
|
||||
@@ -14,14 +14,14 @@ import 'package:veggieseasons/styles.dart';
|
||||
import 'package:veggieseasons/widgets/veggie_card.dart';
|
||||
|
||||
class ListScreen extends StatelessWidget {
|
||||
ListScreen({this.restorationId, Key key}) : super(key: key);
|
||||
const ListScreen({this.restorationId, Key key}) : super(key: key);
|
||||
|
||||
final String restorationId;
|
||||
|
||||
Widget _generateVeggieRow(Veggie veggie, Preferences prefs,
|
||||
{bool inSeason = true}) {
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(left: 16, right: 16, bottom: 24),
|
||||
padding: const EdgeInsets.only(left: 16, right: 16, bottom: 24),
|
||||
child: FutureBuilder<Set<VeggieCategory>>(
|
||||
future: prefs.preferredCategories,
|
||||
builder: (context, snapshot) {
|
||||
|
||||
@@ -11,7 +11,7 @@ import 'package:veggieseasons/data/veggie.dart';
|
||||
import 'package:veggieseasons/widgets/veggie_headline.dart';
|
||||
|
||||
class SearchScreen extends StatefulWidget {
|
||||
SearchScreen({this.restorationId, Key key}) : super(key: key);
|
||||
const SearchScreen({this.restorationId, Key key}) : super(key: key);
|
||||
|
||||
final String restorationId;
|
||||
|
||||
@@ -85,7 +85,7 @@ class _SearchScreenState extends State<SearchScreen> with RestorationMixin {
|
||||
);
|
||||
} else {
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(left: 16, right: 16, bottom: 24),
|
||||
padding: const EdgeInsets.only(left: 16, right: 16, bottom: 24),
|
||||
child: VeggieHeadline(veggies[i - 1]),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -13,7 +13,8 @@ import 'package:veggieseasons/widgets/settings_group.dart';
|
||||
import 'package:veggieseasons/widgets/settings_item.dart';
|
||||
|
||||
class VeggieCategorySettingsScreen extends StatelessWidget {
|
||||
VeggieCategorySettingsScreen({Key key, this.restorationId}) : super(key: key);
|
||||
const VeggieCategorySettingsScreen({Key key, this.restorationId})
|
||||
: super(key: key);
|
||||
|
||||
final String restorationId;
|
||||
|
||||
@@ -24,7 +25,7 @@ class VeggieCategorySettingsScreen extends StatelessWidget {
|
||||
static Route<void> _routeBuilder(BuildContext context, Object argument) {
|
||||
return CupertinoPageRoute(
|
||||
builder: (context) =>
|
||||
VeggieCategorySettingsScreen(restorationId: 'category'),
|
||||
const VeggieCategorySettingsScreen(restorationId: 'category'),
|
||||
title: 'Preferred Categories',
|
||||
);
|
||||
}
|
||||
@@ -37,7 +38,7 @@ class VeggieCategorySettingsScreen extends StatelessWidget {
|
||||
return RestorationScope(
|
||||
restorationId: restorationId,
|
||||
child: CupertinoPageScaffold(
|
||||
navigationBar: CupertinoNavigationBar(
|
||||
navigationBar: const CupertinoNavigationBar(
|
||||
middle: Text('Preferred Categories'),
|
||||
previousPageTitle: 'Settings',
|
||||
),
|
||||
@@ -65,7 +66,7 @@ class VeggieCategorySettingsScreen extends StatelessWidget {
|
||||
},
|
||||
);
|
||||
} else {
|
||||
toggle = CupertinoSwitch(
|
||||
toggle = const CupertinoSwitch(
|
||||
value: false,
|
||||
onChanged: null,
|
||||
);
|
||||
@@ -93,7 +94,7 @@ class VeggieCategorySettingsScreen extends StatelessWidget {
|
||||
}
|
||||
|
||||
class CalorieSettingsScreen extends StatelessWidget {
|
||||
CalorieSettingsScreen({Key key, this.restorationId}) : super(key: key);
|
||||
const CalorieSettingsScreen({Key key, this.restorationId}) : super(key: key);
|
||||
|
||||
final String restorationId;
|
||||
|
||||
@@ -107,7 +108,8 @@ class CalorieSettingsScreen extends StatelessWidget {
|
||||
|
||||
static Route<void> _routeBuilder(BuildContext context, Object argument) {
|
||||
return CupertinoPageRoute<void>(
|
||||
builder: (context) => CalorieSettingsScreen(restorationId: 'calorie'),
|
||||
builder: (context) =>
|
||||
const CalorieSettingsScreen(restorationId: 'calorie'),
|
||||
title: 'Calorie Target',
|
||||
);
|
||||
}
|
||||
@@ -119,7 +121,7 @@ class CalorieSettingsScreen extends StatelessWidget {
|
||||
return RestorationScope(
|
||||
restorationId: restorationId,
|
||||
child: CupertinoPageScaffold(
|
||||
navigationBar: CupertinoNavigationBar(
|
||||
navigationBar: const CupertinoNavigationBar(
|
||||
previousPageTitle: 'Settings',
|
||||
),
|
||||
backgroundColor: Styles.scaffoldBackground(brightness),
|
||||
@@ -152,9 +154,10 @@ class CalorieSettingsScreen extends StatelessWidget {
|
||||
|
||||
return SettingsGroup(
|
||||
items: steps,
|
||||
header: SettingsGroupHeader('Available calorie levels'),
|
||||
footer: SettingsGroupFooter('These are used for serving '
|
||||
'calculations'),
|
||||
header: const SettingsGroupHeader('Available calorie levels'),
|
||||
footer:
|
||||
const SettingsGroupFooter('These are used for serving '
|
||||
'calculations'),
|
||||
);
|
||||
},
|
||||
),
|
||||
@@ -166,14 +169,14 @@ class CalorieSettingsScreen extends StatelessWidget {
|
||||
}
|
||||
|
||||
class SettingsScreen extends StatelessWidget {
|
||||
SettingsScreen({this.restorationId, Key key}) : super(key: key);
|
||||
const SettingsScreen({this.restorationId, Key key}) : super(key: key);
|
||||
|
||||
final String restorationId;
|
||||
|
||||
SettingsItem _buildCaloriesItem(BuildContext context, Preferences prefs) {
|
||||
return SettingsItem(
|
||||
label: 'Calorie Target',
|
||||
icon: SettingsIcon(
|
||||
icon: const SettingsIcon(
|
||||
backgroundColor: Styles.iconBlue,
|
||||
icon: Styles.calorieIcon,
|
||||
),
|
||||
@@ -186,8 +189,8 @@ class SettingsScreen extends StatelessWidget {
|
||||
snapshot.data?.toString() ?? '',
|
||||
style: CupertinoTheme.of(context).textTheme.textStyle,
|
||||
),
|
||||
SizedBox(width: 8),
|
||||
SettingsNavigationIndicator(),
|
||||
const SizedBox(width: 8),
|
||||
const SettingsNavigationIndicator(),
|
||||
],
|
||||
);
|
||||
},
|
||||
@@ -202,11 +205,11 @@ class SettingsScreen extends StatelessWidget {
|
||||
return SettingsItem(
|
||||
label: 'Preferred Categories',
|
||||
subtitle: 'What types of veggies you prefer!',
|
||||
icon: SettingsIcon(
|
||||
icon: const SettingsIcon(
|
||||
backgroundColor: Styles.iconGold,
|
||||
icon: Styles.preferenceIcon,
|
||||
),
|
||||
content: SettingsNavigationIndicator(),
|
||||
content: const SettingsNavigationIndicator(),
|
||||
onPress: () {
|
||||
VeggieCategorySettingsScreen.show(Navigator.of(context));
|
||||
},
|
||||
@@ -217,23 +220,23 @@ class SettingsScreen extends StatelessWidget {
|
||||
BuildContext context, Preferences prefs) {
|
||||
return SettingsItem(
|
||||
label: 'Restore Defaults',
|
||||
icon: SettingsIcon(
|
||||
icon: const SettingsIcon(
|
||||
backgroundColor: CupertinoColors.systemRed,
|
||||
icon: Styles.resetIcon,
|
||||
),
|
||||
content: SettingsNavigationIndicator(),
|
||||
content: const SettingsNavigationIndicator(),
|
||||
onPress: () {
|
||||
showCupertinoDialog<void>(
|
||||
context: context,
|
||||
builder: (context) => CupertinoAlertDialog(
|
||||
title: Text('Are you sure?'),
|
||||
content: Text(
|
||||
title: const Text('Are you sure?'),
|
||||
content: const Text(
|
||||
'Are you sure you want to reset the current settings?',
|
||||
),
|
||||
actions: <Widget>[
|
||||
CupertinoDialogAction(
|
||||
isDestructiveAction: true,
|
||||
child: Text('Yes'),
|
||||
child: const Text('Yes'),
|
||||
onPressed: () async {
|
||||
await prefs.restoreDefaults();
|
||||
Navigator.pop(context);
|
||||
@@ -241,7 +244,7 @@ class SettingsScreen extends StatelessWidget {
|
||||
),
|
||||
CupertinoDialogAction(
|
||||
isDefaultAction: true,
|
||||
child: Text('No'),
|
||||
child: const Text('No'),
|
||||
onPressed: () => Navigator.pop(context),
|
||||
)
|
||||
],
|
||||
@@ -264,7 +267,7 @@ class SettingsScreen extends StatelessWidget {
|
||||
child: CustomScrollView(
|
||||
restorationId: 'list',
|
||||
slivers: <Widget>[
|
||||
CupertinoSliverNavigationBar(
|
||||
const CupertinoSliverNavigationBar(
|
||||
largeTitle: Text('Settings'),
|
||||
),
|
||||
SliverSafeArea(
|
||||
|
||||
@@ -8,7 +8,7 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:veggieseasons/data/veggie.dart';
|
||||
|
||||
abstract class Styles {
|
||||
static CupertinoThemeData veggieThemeData = CupertinoThemeData(
|
||||
static CupertinoThemeData veggieThemeData = const CupertinoThemeData(
|
||||
textTheme: CupertinoTextThemeData(
|
||||
textStyle: TextStyle(
|
||||
color: CupertinoColors.label,
|
||||
@@ -30,7 +30,7 @@ abstract class Styles {
|
||||
|
||||
static TextStyle minorText(CupertinoThemeData themeData) =>
|
||||
themeData.textTheme.textStyle.copyWith(
|
||||
color: Color.fromRGBO(128, 128, 128, 1),
|
||||
color: const Color.fromRGBO(128, 128, 128, 1),
|
||||
);
|
||||
|
||||
static TextStyle headlineName(CupertinoThemeData themeData) =>
|
||||
@@ -41,19 +41,19 @@ abstract class Styles {
|
||||
|
||||
static TextStyle cardTitleText(CupertinoThemeData themeData) =>
|
||||
themeData.textTheme.textStyle.copyWith(
|
||||
color: Color.fromRGBO(0, 0, 0, 0.9),
|
||||
color: const Color.fromRGBO(0, 0, 0, 0.9),
|
||||
fontSize: 32,
|
||||
fontWeight: FontWeight.bold,
|
||||
);
|
||||
|
||||
static TextStyle cardCategoryText(CupertinoThemeData themeData) =>
|
||||
themeData.textTheme.textStyle.copyWith(
|
||||
color: Color.fromRGBO(255, 255, 255, 0.9),
|
||||
color: const Color.fromRGBO(255, 255, 255, 0.9),
|
||||
);
|
||||
|
||||
static TextStyle cardDescriptionText(CupertinoThemeData themeData) =>
|
||||
themeData.textTheme.textStyle.copyWith(
|
||||
color: Color.fromRGBO(0, 0, 0, 0.9),
|
||||
color: const Color.fromRGBO(0, 0, 0, 0.9),
|
||||
);
|
||||
|
||||
static TextStyle detailsTitleText(CupertinoThemeData themeData) =>
|
||||
@@ -69,13 +69,13 @@ abstract class Styles {
|
||||
|
||||
static TextStyle detailsBoldDescriptionText(CupertinoThemeData themeData) =>
|
||||
themeData.textTheme.textStyle.copyWith(
|
||||
color: Color.fromRGBO(0, 0, 0, 0.9),
|
||||
color: const Color.fromRGBO(0, 0, 0, 0.9),
|
||||
fontWeight: FontWeight.bold,
|
||||
);
|
||||
|
||||
static TextStyle detailsServingHeaderText(CupertinoThemeData themeData) =>
|
||||
themeData.textTheme.textStyle.copyWith(
|
||||
color: Color.fromRGBO(176, 176, 176, 1),
|
||||
color: const Color.fromRGBO(176, 176, 176, 1),
|
||||
fontWeight: FontWeight.bold,
|
||||
);
|
||||
|
||||
@@ -198,7 +198,9 @@ abstract class Styles {
|
||||
: CupertinoColors.darkBackgroundGray;
|
||||
|
||||
static Color settingsLineation(Brightness brightness) =>
|
||||
brightness == Brightness.light ? Color(0xffbcbbc1) : Color(0xff4c4b4b);
|
||||
brightness == Brightness.light
|
||||
? const Color(0xffbcbbc1)
|
||||
: const Color(0xff4c4b4b);
|
||||
|
||||
static const Color settingsBackground = Color(0xffefeff4);
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ class FrostedBox extends StatelessWidget {
|
||||
return BackdropFilter(
|
||||
filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10),
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
decoration: const BoxDecoration(
|
||||
color: Styles.frostedBackground,
|
||||
),
|
||||
child: child,
|
||||
@@ -117,7 +117,7 @@ class CloseButtonState extends State<CloseButton> {
|
||||
child: Center(
|
||||
child: ColorChangingIcon(
|
||||
CupertinoIcons.clear_thick,
|
||||
duration: Duration(milliseconds: 300),
|
||||
duration: const Duration(milliseconds: 300),
|
||||
color: tapInProgress
|
||||
? Styles.closeButtonPressed
|
||||
: Styles.closeButtonUnpressed,
|
||||
|
||||
@@ -21,7 +21,7 @@ class SettingsGroupHeader extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 15,
|
||||
right: 15,
|
||||
bottom: 6,
|
||||
@@ -42,7 +42,7 @@ class SettingsGroupFooter extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 15,
|
||||
right: 15,
|
||||
top: 7.5,
|
||||
|
||||
@@ -20,7 +20,7 @@ class SettingsNavigationIndicator extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Icon(
|
||||
return const Icon(
|
||||
CupertinoIcons.forward,
|
||||
color: Styles.settingsMediumGray,
|
||||
size: 21,
|
||||
@@ -99,7 +99,7 @@ class SettingsItemState extends State<SettingsItem> {
|
||||
});
|
||||
await widget.onPress();
|
||||
Future.delayed(
|
||||
Duration(milliseconds: 150),
|
||||
const Duration(milliseconds: 150),
|
||||
() {
|
||||
setState(() {
|
||||
pressed = false;
|
||||
@@ -133,10 +133,10 @@ class SettingsItemState extends State<SettingsItem> {
|
||||
? Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
SizedBox(height: 8.5),
|
||||
const SizedBox(height: 8.5),
|
||||
Text(widget.label,
|
||||
style: themeData.textTheme.textStyle),
|
||||
SizedBox(height: 4),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
widget.subtitle,
|
||||
style: Styles.settingsItemSubtitleText(themeData),
|
||||
@@ -144,7 +144,7 @@ class SettingsItemState extends State<SettingsItem> {
|
||||
],
|
||||
)
|
||||
: Padding(
|
||||
padding: EdgeInsets.only(top: 1.5),
|
||||
padding: const EdgeInsets.only(top: 1.5),
|
||||
child: Text(widget.label,
|
||||
style: themeData.textTheme.textStyle),
|
||||
),
|
||||
|
||||
@@ -135,7 +135,7 @@ class _TriviaViewState extends State<TriviaView> with RestorationMixin {
|
||||
'All done!',
|
||||
style: Styles.triviaFinishedTitleText(themeData),
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
const SizedBox(height: 16),
|
||||
Text('You answered', style: themeData.textTheme.textStyle),
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@@ -157,9 +157,9 @@ class _TriviaViewState extends State<TriviaView> with RestorationMixin {
|
||||
],
|
||||
),
|
||||
Text('questions correctly!', style: themeData.textTheme.textStyle),
|
||||
SizedBox(height: 16),
|
||||
const SizedBox(height: 16),
|
||||
CupertinoButton(
|
||||
child: Text('Try Again'),
|
||||
child: const Text('Try Again'),
|
||||
onPressed: () => _resetGame(),
|
||||
),
|
||||
],
|
||||
@@ -173,12 +173,12 @@ class _TriviaViewState extends State<TriviaView> with RestorationMixin {
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(height: 16),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
currentTrivia.question,
|
||||
style: CupertinoTheme.of(context).textTheme.textStyle,
|
||||
),
|
||||
SizedBox(height: 32),
|
||||
const SizedBox(height: 32),
|
||||
for (int i = 0; i < currentTrivia.answers.length; i++)
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8),
|
||||
@@ -209,9 +209,9 @@ class _TriviaViewState extends State<TriviaView> with RestorationMixin {
|
||||
: 'Sorry, that wasn\'t the right answer.',
|
||||
style: CupertinoTheme.of(context).textTheme.textStyle,
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
const SizedBox(height: 16),
|
||||
CupertinoButton(
|
||||
child: Text('Next Question'),
|
||||
child: const Text('Next Question'),
|
||||
onPressed: () => setState(() {
|
||||
triviaIndex.value++;
|
||||
status.value = PlayerStatus.readyToAnswer;
|
||||
|
||||
@@ -105,7 +105,7 @@ class _PressableCardState extends State<PressableCard> {
|
||||
}
|
||||
|
||||
class VeggieCard extends StatelessWidget {
|
||||
VeggieCard(this.veggie, this.isInSeason, this.isPreferredCategory);
|
||||
const VeggieCard(this.veggie, this.isInSeason, this.isPreferredCategory);
|
||||
|
||||
/// Veggie to be displayed by the card.
|
||||
final Veggie veggie;
|
||||
@@ -120,7 +120,7 @@ class VeggieCard extends StatelessWidget {
|
||||
Widget _buildDetails(BuildContext context) {
|
||||
final themeData = CupertinoTheme.of(context);
|
||||
return FrostyBackground(
|
||||
color: Color(0x90ffffff),
|
||||
color: const Color(0x90ffffff),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
|
||||
@@ -49,7 +49,7 @@ class VeggieHeadline extends StatelessWidget {
|
||||
var widgets = <Widget>[];
|
||||
|
||||
for (var season in seasons) {
|
||||
widgets.add(SizedBox(width: 4));
|
||||
widgets.add(const SizedBox(width: 4));
|
||||
widgets.add(
|
||||
Container(
|
||||
height: 10,
|
||||
@@ -80,7 +80,7 @@ class VeggieHeadline extends StatelessWidget {
|
||||
height: 72,
|
||||
width: 72,
|
||||
),
|
||||
SizedBox(width: 8),
|
||||
const SizedBox(width: 8),
|
||||
Flexible(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
|
||||
@@ -9,74 +9,32 @@ project 'Runner', {
|
||||
'Release' => :release,
|
||||
}
|
||||
|
||||
def parse_KV_file(file, separator='=')
|
||||
file_abs_path = File.expand_path(file)
|
||||
if !File.exists? file_abs_path
|
||||
return [];
|
||||
def flutter_root
|
||||
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__)
|
||||
unless File.exist?(generated_xcode_build_settings_path)
|
||||
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first"
|
||||
end
|
||||
pods_ary = []
|
||||
skip_line_start_symbols = ["#", "/"]
|
||||
File.foreach(file_abs_path) { |line|
|
||||
next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
|
||||
plugin = line.split(pattern=separator)
|
||||
if plugin.length == 2
|
||||
podname = plugin[0].strip()
|
||||
path = plugin[1].strip()
|
||||
podpath = File.expand_path("#{path}", file_abs_path)
|
||||
pods_ary.push({:name => podname, :path => podpath});
|
||||
else
|
||||
puts "Invalid plugin specification: #{line}"
|
||||
end
|
||||
}
|
||||
return pods_ary
|
||||
|
||||
File.foreach(generated_xcode_build_settings_path) do |line|
|
||||
matches = line.match(/FLUTTER_ROOT\=(.*)/)
|
||||
return matches[1].strip if matches
|
||||
end
|
||||
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\""
|
||||
end
|
||||
|
||||
def pubspec_supports_macos(file)
|
||||
file_abs_path = File.expand_path(file)
|
||||
if !File.exists? file_abs_path
|
||||
return false;
|
||||
end
|
||||
File.foreach(file_abs_path) { |line|
|
||||
return true if line =~ /^\s*macos:/
|
||||
}
|
||||
return false
|
||||
end
|
||||
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
|
||||
|
||||
flutter_macos_podfile_setup
|
||||
|
||||
target 'Runner' do
|
||||
use_frameworks!
|
||||
use_modular_headers!
|
||||
|
||||
# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
|
||||
# referring to absolute paths on developers' machines.
|
||||
ephemeral_dir = File.join('Flutter', 'ephemeral')
|
||||
symlink_dir = File.join(ephemeral_dir, '.symlinks')
|
||||
symlink_plugins_dir = File.join(symlink_dir, 'plugins')
|
||||
system("rm -rf #{symlink_dir}")
|
||||
system("mkdir -p #{symlink_plugins_dir}")
|
||||
|
||||
# Flutter Pods
|
||||
generated_xcconfig = parse_KV_file(File.join(ephemeral_dir, 'Flutter-Generated.xcconfig'))
|
||||
if generated_xcconfig.empty?
|
||||
puts "Flutter-Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first."
|
||||
end
|
||||
generated_xcconfig.map { |p|
|
||||
if p[:name] == 'FLUTTER_FRAMEWORK_DIR'
|
||||
symlink = File.join(symlink_dir, 'flutter')
|
||||
File.symlink(File.dirname(p[:path]), symlink)
|
||||
pod 'FlutterMacOS', :path => File.join(symlink, File.basename(p[:path]))
|
||||
end
|
||||
}
|
||||
|
||||
# Plugin Pods
|
||||
plugin_pods = parse_KV_file('../.flutter-plugins')
|
||||
plugin_pods.map { |p|
|
||||
symlink = File.join(symlink_plugins_dir, p[:name])
|
||||
File.symlink(p[:path], symlink)
|
||||
if pubspec_supports_macos(File.join(symlink, 'pubspec.yaml'))
|
||||
pod p[:name], :path => File.join(symlink, 'macos')
|
||||
end
|
||||
}
|
||||
flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__))
|
||||
end
|
||||
|
||||
# Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system.
|
||||
install! 'cocoapods', :disable_input_output_paths => true
|
||||
post_install do |installer|
|
||||
installer.pods_project.targets.each do |target|
|
||||
flutter_additional_macos_build_settings(target)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,27 +1,22 @@
|
||||
PODS:
|
||||
- FlutterMacOS (1.0.0)
|
||||
- shared_preferences (0.0.1)
|
||||
- shared_preferences_macos (0.0.1):
|
||||
- FlutterMacOS
|
||||
|
||||
DEPENDENCIES:
|
||||
- FlutterMacOS (from `Flutter/ephemeral/.symlinks/flutter/darwin-x64`)
|
||||
- shared_preferences (from `Flutter/ephemeral/.symlinks/plugins/shared_preferences/macos`)
|
||||
- FlutterMacOS (from `Flutter/ephemeral`)
|
||||
- shared_preferences_macos (from `Flutter/ephemeral/.symlinks/plugins/shared_preferences_macos/macos`)
|
||||
|
||||
EXTERNAL SOURCES:
|
||||
FlutterMacOS:
|
||||
:path: Flutter/ephemeral/.symlinks/flutter/darwin-x64
|
||||
shared_preferences:
|
||||
:path: Flutter/ephemeral/.symlinks/plugins/shared_preferences/macos
|
||||
:path: Flutter/ephemeral
|
||||
shared_preferences_macos:
|
||||
:path: Flutter/ephemeral/.symlinks/plugins/shared_preferences_macos/macos
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
FlutterMacOS: 15bea8a44d2fa024068daa0140371c020b4b6ff9
|
||||
shared_preferences: 9fec34d1bd906196a4da48fcf6c3ad521cc00b8d
|
||||
shared_preferences_macos: 5e5c2839894accb56b7d23328905b757f2bafaf6
|
||||
FlutterMacOS: 57701585bf7de1b3fc2bb61f6378d73bbdea8424
|
||||
shared_preferences_macos: 480ce071d0666e37cef23fe6c702293a3d21799e
|
||||
|
||||
PODFILE CHECKSUM: d8ba9b3e9e93c62c74a660b46c6fcb09f03991a7
|
||||
PODFILE CHECKSUM: 6eac6b3292e5142cfc23bdeb71848a40ec51c14c
|
||||
|
||||
COCOAPODS: 1.8.4
|
||||
COCOAPODS: 1.10.1
|
||||
|
||||
@@ -26,11 +26,7 @@
|
||||
33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; };
|
||||
33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; };
|
||||
33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; };
|
||||
33D1A10422148B71006C7A3E /* FlutterMacOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 33D1A10322148B71006C7A3E /* FlutterMacOS.framework */; };
|
||||
33D1A10522148B93006C7A3E /* FlutterMacOS.framework in Bundle Framework */ = {isa = PBXBuildFile; fileRef = 33D1A10322148B71006C7A3E /* FlutterMacOS.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
439430BC46E7EA4F4AD30C97 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 71048CE912B6CDDD9D17E4AB /* Pods_Runner.framework */; };
|
||||
D73912F022F37F9E000D13A0 /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D73912EF22F37F9E000D13A0 /* App.framework */; };
|
||||
D73912F222F3801D000D13A0 /* App.framework in Bundle Framework */ = {isa = PBXBuildFile; fileRef = D73912EF22F37F9E000D13A0 /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
@@ -50,8 +46,6 @@
|
||||
dstPath = "";
|
||||
dstSubfolderSpec = 10;
|
||||
files = (
|
||||
D73912F222F3801D000D13A0 /* App.framework in Bundle Framework */,
|
||||
33D1A10522148B93006C7A3E /* FlutterMacOS.framework in Bundle Framework */,
|
||||
);
|
||||
name = "Bundle Framework";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@@ -70,7 +64,6 @@
|
||||
33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Debug.xcconfig"; sourceTree = "<group>"; };
|
||||
33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Release.xcconfig"; sourceTree = "<group>"; };
|
||||
33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = "Flutter-Generated.xcconfig"; path = "ephemeral/Flutter-Generated.xcconfig"; sourceTree = "<group>"; };
|
||||
33D1A10322148B71006C7A3E /* FlutterMacOS.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FlutterMacOS.framework; path = Flutter/ephemeral/FlutterMacOS.framework; sourceTree = SOURCE_ROOT; };
|
||||
33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = "<group>"; };
|
||||
33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = "<group>"; };
|
||||
33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = "<group>"; };
|
||||
@@ -80,7 +73,6 @@
|
||||
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = "<group>"; };
|
||||
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = "<group>"; };
|
||||
A3B1F279691DA4B9DC4B9D64 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
D73912EF22F37F9E000D13A0 /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/ephemeral/App.framework; sourceTree = SOURCE_ROOT; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@@ -88,8 +80,6 @@
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
D73912F022F37F9E000D13A0 /* App.framework in Frameworks */,
|
||||
33D1A10422148B71006C7A3E /* FlutterMacOS.framework in Frameworks */,
|
||||
439430BC46E7EA4F4AD30C97 /* Pods_Runner.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@@ -145,8 +135,6 @@
|
||||
33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */,
|
||||
33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */,
|
||||
33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */,
|
||||
D73912EF22F37F9E000D13A0 /* App.framework */,
|
||||
33D1A10322148B71006C7A3E /* FlutterMacOS.framework */,
|
||||
);
|
||||
path = Flutter;
|
||||
sourceTree = "<group>";
|
||||
@@ -281,7 +269,7 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "echo \"$PRODUCT_NAME.app\" > \"$PROJECT_DIR\"/Flutter/ephemeral/.app_filename\n";
|
||||
shellScript = "echo \"$PRODUCT_NAME.app\" > \"$PROJECT_DIR\"/Flutter/ephemeral/.app_filename && \"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh embed\n";
|
||||
};
|
||||
33CC111E2044C6BF0003C045 /* ShellScript */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
@@ -308,10 +296,13 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
inputPaths = (
|
||||
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
|
||||
"${BUILT_PRODUCTS_DIR}/shared_preferences_macos/shared_preferences_macos.framework",
|
||||
);
|
||||
name = "[CP] Embed Pods Frameworks";
|
||||
outputFileListPaths = (
|
||||
outputPaths = (
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/shared_preferences_macos.framework",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
|
||||
@@ -70,7 +70,7 @@ packages:
|
||||
name: cupertino_icons
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.2"
|
||||
version: "1.0.3"
|
||||
fake_async:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -84,14 +84,14 @@ packages:
|
||||
name: ffi
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.0"
|
||||
version: "1.1.1"
|
||||
file:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: file
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "6.1.0"
|
||||
version: "6.1.1"
|
||||
flutter:
|
||||
dependency: "direct main"
|
||||
description: flutter
|
||||
@@ -104,6 +104,13 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.9.0"
|
||||
flutter_lints:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: flutter_lints
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.3"
|
||||
flutter_test:
|
||||
dependency: "direct dev"
|
||||
description: flutter
|
||||
@@ -142,6 +149,13 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.6.3"
|
||||
lints:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: lints
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.1"
|
||||
matcher:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -191,13 +205,6 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.1"
|
||||
pedantic:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: pedantic
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.11.0"
|
||||
petitparser:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -239,7 +246,7 @@ packages:
|
||||
name: shared_preferences
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.5"
|
||||
version: "2.0.6"
|
||||
shared_preferences_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -342,7 +349,7 @@ packages:
|
||||
name: win32
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.5"
|
||||
version: "2.1.3"
|
||||
xdg_directories:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -356,7 +363,7 @@ packages:
|
||||
name: xml
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "5.1.0"
|
||||
version: "5.1.1"
|
||||
yaml:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -365,5 +372,5 @@ packages:
|
||||
source: hosted
|
||||
version: "3.1.0"
|
||||
sdks:
|
||||
dart: ">=2.12.0 <3.0.0"
|
||||
dart: ">=2.13.0 <3.0.0"
|
||||
flutter: ">=1.20.0"
|
||||
|
||||
@@ -19,11 +19,10 @@ dependencies:
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
pedantic: ^1.11.0
|
||||
flutter_lints: ^1.0.0
|
||||
flutter_launcher_icons: ^0.9.0
|
||||
|
||||
flutter:
|
||||
|
||||
assets:
|
||||
- assets/images/apple.jpg
|
||||
- assets/images/artichoke.jpg
|
||||
|
||||
Reference in New Issue
Block a user