mirror of
https://github.com/flutter/samples.git
synced 2025-11-08 22:09:06 +00:00
Adds analysis options to Veggie Seasons (#98)
This commit is contained in:
30
veggieseasons/analysis_options.yaml
Normal file
30
veggieseasons/analysis_options.yaml
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
include: package:pedantic/analysis_options.yaml
|
||||||
|
|
||||||
|
analyzer:
|
||||||
|
strong-mode:
|
||||||
|
implicit-casts: false
|
||||||
|
implicit-dynamic: false
|
||||||
|
|
||||||
|
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
|
||||||
|
- 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
|
||||||
@@ -19,4 +19,4 @@ SPEC CHECKSUMS:
|
|||||||
|
|
||||||
PODFILE CHECKSUM: e8988baac3a50f787b9d3ed7ca44957b442f92a7
|
PODFILE CHECKSUM: e8988baac3a50f787b9d3ed7ca44957b442f92a7
|
||||||
|
|
||||||
COCOAPODS: 1.7.0
|
COCOAPODS: 1.7.1
|
||||||
|
|||||||
@@ -32,19 +32,19 @@ class Preferences extends Model {
|
|||||||
return Set.from(_preferredCategories);
|
return Set.from(_preferredCategories);
|
||||||
}
|
}
|
||||||
|
|
||||||
void addPreferredCategory(VeggieCategory category) async {
|
Future<void> addPreferredCategory(VeggieCategory category) async {
|
||||||
_preferredCategories.add(category);
|
_preferredCategories.add(category);
|
||||||
await _saveToSharedPrefs();
|
await _saveToSharedPrefs();
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
void removePreferredCategory(VeggieCategory category) async {
|
Future<void> removePreferredCategory(VeggieCategory category) async {
|
||||||
_preferredCategories.remove(category);
|
_preferredCategories.remove(category);
|
||||||
await _saveToSharedPrefs();
|
await _saveToSharedPrefs();
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
void setDesiredCalories(int calories) async {
|
Future<void> setDesiredCalories(int calories) async {
|
||||||
_desiredCalories = calories;
|
_desiredCalories = calories;
|
||||||
await _saveToSharedPrefs();
|
await _saveToSharedPrefs();
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ class ServingInfoChart extends StatelessWidget {
|
|||||||
// value of this vitamin" data adjusted for the user's preferred calorie
|
// value of this vitamin" data adjusted for the user's preferred calorie
|
||||||
// target.
|
// target.
|
||||||
Widget _buildVitaminText(int standardPercentage, Future<int> targetCalories) {
|
Widget _buildVitaminText(int standardPercentage, Future<int> targetCalories) {
|
||||||
return FutureBuilder(
|
return FutureBuilder<int>(
|
||||||
future: targetCalories,
|
future: targetCalories,
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
final target = snapshot?.data ?? 2000;
|
final target = snapshot?.data ?? 2000;
|
||||||
@@ -172,7 +172,7 @@ class InfoView extends StatelessWidget {
|
|||||||
Row(
|
Row(
|
||||||
mainAxisSize: MainAxisSize.max,
|
mainAxisSize: MainAxisSize.max,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
FutureBuilder(
|
FutureBuilder<Set<VeggieCategory>>(
|
||||||
future: prefs.preferredCategories,
|
future: prefs.preferredCategories,
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
return Text(
|
return Text(
|
||||||
@@ -284,7 +284,7 @@ class _DetailsScreenState extends State<DetailsScreen> {
|
|||||||
Expanded(
|
Expanded(
|
||||||
child: ListView(
|
child: ListView(
|
||||||
children: [
|
children: [
|
||||||
CupertinoSegmentedControl(
|
CupertinoSegmentedControl<int>(
|
||||||
children: {
|
children: {
|
||||||
0: Text('Facts & Info'),
|
0: Text('Facts & Info'),
|
||||||
1: Text('Trivia'),
|
1: Text('Trivia'),
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ import 'package:veggieseasons/styles.dart';
|
|||||||
import 'package:veggieseasons/widgets/veggie_card.dart';
|
import 'package:veggieseasons/widgets/veggie_card.dart';
|
||||||
|
|
||||||
class ListScreen extends StatelessWidget {
|
class ListScreen extends StatelessWidget {
|
||||||
Widget _generateVeggieRow(veggie, Preferences prefs, {bool inSeason = true}) {
|
Widget _generateVeggieRow(Veggie veggie, Preferences prefs,
|
||||||
|
{bool inSeason = true}) {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: EdgeInsets.only(left: 16, right: 16, bottom: 24),
|
padding: EdgeInsets.only(left: 16, right: 16, bottom: 24),
|
||||||
child: FutureBuilder<Set<VeggieCategory>>(
|
child: FutureBuilder<Set<VeggieCategory>>(
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ class CalorieSettingsScreen extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class SettingsScreen extends StatelessWidget {
|
class SettingsScreen extends StatelessWidget {
|
||||||
Widget _buildCaloriesItem(BuildContext context, Preferences prefs) {
|
SettingsItem _buildCaloriesItem(BuildContext context, Preferences prefs) {
|
||||||
return SettingsItem(
|
return SettingsItem(
|
||||||
label: 'Calorie Target',
|
label: 'Calorie Target',
|
||||||
icon: SettingsIcon(
|
icon: SettingsIcon(
|
||||||
@@ -146,7 +146,7 @@ class SettingsScreen extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
onPress: () {
|
onPress: () {
|
||||||
Navigator.of(context).push(
|
Navigator.of(context).push<void>(
|
||||||
CupertinoPageRoute(
|
CupertinoPageRoute(
|
||||||
builder: (context) => CalorieSettingsScreen(),
|
builder: (context) => CalorieSettingsScreen(),
|
||||||
title: 'Calorie Target',
|
title: 'Calorie Target',
|
||||||
@@ -156,7 +156,7 @@ class SettingsScreen extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildCategoriesItem(BuildContext context, Preferences prefs) {
|
SettingsItem _buildCategoriesItem(BuildContext context, Preferences prefs) {
|
||||||
return SettingsItem(
|
return SettingsItem(
|
||||||
label: 'Preferred Categories',
|
label: 'Preferred Categories',
|
||||||
subtitle: 'What types of veggies you prefer!',
|
subtitle: 'What types of veggies you prefer!',
|
||||||
@@ -166,7 +166,7 @@ class SettingsScreen extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
content: SettingsNavigationIndicator(),
|
content: SettingsNavigationIndicator(),
|
||||||
onPress: () {
|
onPress: () {
|
||||||
Navigator.of(context).push(
|
Navigator.of(context).push<void>(
|
||||||
CupertinoPageRoute(
|
CupertinoPageRoute(
|
||||||
builder: (context) => VeggieCategorySettingsScreen(),
|
builder: (context) => VeggieCategorySettingsScreen(),
|
||||||
title: 'Preferred Categories',
|
title: 'Preferred Categories',
|
||||||
|
|||||||
@@ -69,12 +69,12 @@ class _ColorChangingIconState
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void forEachTween(visitor) {
|
void forEachTween(TweenVisitor<dynamic> visitor) {
|
||||||
_colorTween = visitor(
|
_colorTween = visitor(
|
||||||
_colorTween,
|
_colorTween,
|
||||||
widget.color,
|
widget.color,
|
||||||
(dynamic value) => ColorTween(begin: value),
|
(dynamic value) => ColorTween(begin: value as Color),
|
||||||
);
|
) as ColorTween;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ class SettingsGroup extends StatelessWidget {
|
|||||||
this.header,
|
this.header,
|
||||||
this.footer,
|
this.footer,
|
||||||
}) : assert(items != null),
|
}) : assert(items != null),
|
||||||
assert(items.length > 0);
|
assert(items.isNotEmpty);
|
||||||
|
|
||||||
final List<SettingsItem> items;
|
final List<SettingsItem> items;
|
||||||
final Widget header;
|
final Widget header;
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ class VeggieCard extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return PressableCard(
|
return PressableCard(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.of(context).push(CupertinoPageRoute(
|
Navigator.of(context).push<void>(CupertinoPageRoute(
|
||||||
builder: (context) => DetailsScreen(veggie.id),
|
builder: (context) => DetailsScreen(veggie.id),
|
||||||
fullscreenDialog: true,
|
fullscreenDialog: true,
|
||||||
));
|
));
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ class VeggieHeadline extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () => Navigator.of(context).push(CupertinoPageRoute(
|
onTap: () => Navigator.of(context).push<void>(CupertinoPageRoute(
|
||||||
builder: (context) => DetailsScreen(veggie.id),
|
builder: (context) => DetailsScreen(veggie.id),
|
||||||
fullscreenDialog: true,
|
fullscreenDialog: true,
|
||||||
)),
|
)),
|
||||||
|
|||||||
@@ -7,14 +7,14 @@ packages:
|
|||||||
name: archive
|
name: archive
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.8"
|
version: "2.0.10"
|
||||||
args:
|
args:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: args
|
name: args
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.5.0"
|
version: "1.5.2"
|
||||||
async:
|
async:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -64,15 +64,6 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.1.2"
|
version: "0.1.2"
|
||||||
dart_config:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
path: "."
|
|
||||||
ref: HEAD
|
|
||||||
resolved-ref: a7ed88a4793e094a4d5d5c2d88a89e55510accde
|
|
||||||
url: "https://github.com/MarkOSullivan94/dart_config.git"
|
|
||||||
source: git
|
|
||||||
version: "0.5.0"
|
|
||||||
flutter:
|
flutter:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description: flutter
|
description: flutter
|
||||||
@@ -84,7 +75,7 @@ packages:
|
|||||||
name: flutter_launcher_icons
|
name: flutter_launcher_icons
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.7.0"
|
version: "0.7.2+1"
|
||||||
flutter_test:
|
flutter_test:
|
||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
description: flutter
|
description: flutter
|
||||||
@@ -103,14 +94,14 @@ packages:
|
|||||||
name: image
|
name: image
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.7"
|
version: "2.1.4"
|
||||||
intl:
|
intl:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: intl
|
name: intl
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.15.7"
|
version: "0.15.8"
|
||||||
matcher:
|
matcher:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -133,7 +124,7 @@ packages:
|
|||||||
source: hosted
|
source: hosted
|
||||||
version: "1.6.2"
|
version: "1.6.2"
|
||||||
pedantic:
|
pedantic:
|
||||||
dependency: transitive
|
dependency: "direct dev"
|
||||||
description:
|
description:
|
||||||
name: pedantic
|
name: pedantic
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
@@ -145,7 +136,7 @@ packages:
|
|||||||
name: petitparser
|
name: petitparser
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.1"
|
version: "2.2.1"
|
||||||
quiver:
|
quiver:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -166,7 +157,7 @@ packages:
|
|||||||
name: shared_preferences
|
name: shared_preferences
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.4.3"
|
version: "0.5.3+1"
|
||||||
sky_engine:
|
sky_engine:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description: flutter
|
description: flutter
|
||||||
@@ -234,14 +225,14 @@ packages:
|
|||||||
name: xml
|
name: xml
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.3.1"
|
version: "3.4.1"
|
||||||
yaml:
|
yaml:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: yaml
|
name: yaml
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.15"
|
version: "2.1.16"
|
||||||
sdks:
|
sdks:
|
||||||
dart: ">=2.3.0-dev <3.0.0"
|
dart: ">=2.3.0-dev <3.0.0"
|
||||||
flutter: ">=0.1.4 <2.0.0"
|
flutter: ">=1.5.0 <2.0.0"
|
||||||
|
|||||||
@@ -12,15 +12,16 @@ dependencies:
|
|||||||
|
|
||||||
cupertino_icons: ^0.1.2
|
cupertino_icons: ^0.1.2
|
||||||
font_awesome_flutter: ^8.4.0
|
font_awesome_flutter: ^8.4.0
|
||||||
intl: ^0.15.7
|
intl: ^0.15.8
|
||||||
scoped_model: ^1.0.1
|
scoped_model: ^1.0.1
|
||||||
shared_preferences: ^0.4.3
|
shared_preferences: ^0.5.3+1
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
|
||||||
flutter_launcher_icons: ^0.7.0
|
pedantic: 1.5.0
|
||||||
|
flutter_launcher_icons: ^0.7.2+1
|
||||||
|
|
||||||
flutter:
|
flutter:
|
||||||
|
|
||||||
|
|||||||
@@ -7,5 +7,5 @@
|
|||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
testWidgets('This test always passes', (WidgetTester tester) async {});
|
testWidgets('This test always passes', (tester) async {});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user