Adds analysis options to Veggie Seasons ()

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

@ -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
COCOAPODS: 1.7.0
COCOAPODS: 1.7.1

@ -32,19 +32,19 @@ class Preferences extends Model {
return Set.from(_preferredCategories);
}
void addPreferredCategory(VeggieCategory category) async {
Future<void> addPreferredCategory(VeggieCategory category) async {
_preferredCategories.add(category);
await _saveToSharedPrefs();
notifyListeners();
}
void removePreferredCategory(VeggieCategory category) async {
Future<void> removePreferredCategory(VeggieCategory category) async {
_preferredCategories.remove(category);
await _saveToSharedPrefs();
notifyListeners();
}
void setDesiredCalories(int calories) async {
Future<void> setDesiredCalories(int calories) async {
_desiredCalories = calories;
await _saveToSharedPrefs();
notifyListeners();

@ -23,7 +23,7 @@ class ServingInfoChart extends StatelessWidget {
// value of this vitamin" data adjusted for the user's preferred calorie
// target.
Widget _buildVitaminText(int standardPercentage, Future<int> targetCalories) {
return FutureBuilder(
return FutureBuilder<int>(
future: targetCalories,
builder: (context, snapshot) {
final target = snapshot?.data ?? 2000;
@ -172,7 +172,7 @@ class InfoView extends StatelessWidget {
Row(
mainAxisSize: MainAxisSize.max,
children: <Widget>[
FutureBuilder(
FutureBuilder<Set<VeggieCategory>>(
future: prefs.preferredCategories,
builder: (context, snapshot) {
return Text(
@ -284,7 +284,7 @@ class _DetailsScreenState extends State<DetailsScreen> {
Expanded(
child: ListView(
children: [
CupertinoSegmentedControl(
CupertinoSegmentedControl<int>(
children: {
0: Text('Facts & Info'),
1: Text('Trivia'),

@ -13,7 +13,8 @@ import 'package:veggieseasons/styles.dart';
import 'package:veggieseasons/widgets/veggie_card.dart';
class ListScreen extends StatelessWidget {
Widget _generateVeggieRow(veggie, Preferences prefs, {bool inSeason = true}) {
Widget _generateVeggieRow(Veggie veggie, Preferences prefs,
{bool inSeason = true}) {
return Padding(
padding: EdgeInsets.only(left: 16, right: 16, bottom: 24),
child: FutureBuilder<Set<VeggieCategory>>(

@ -126,7 +126,7 @@ class CalorieSettingsScreen extends StatelessWidget {
}
class SettingsScreen extends StatelessWidget {
Widget _buildCaloriesItem(BuildContext context, Preferences prefs) {
SettingsItem _buildCaloriesItem(BuildContext context, Preferences prefs) {
return SettingsItem(
label: 'Calorie Target',
icon: SettingsIcon(
@ -146,7 +146,7 @@ class SettingsScreen extends StatelessWidget {
},
),
onPress: () {
Navigator.of(context).push(
Navigator.of(context).push<void>(
CupertinoPageRoute(
builder: (context) => CalorieSettingsScreen(),
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(
label: 'Preferred Categories',
subtitle: 'What types of veggies you prefer!',
@ -166,7 +166,7 @@ class SettingsScreen extends StatelessWidget {
),
content: SettingsNavigationIndicator(),
onPress: () {
Navigator.of(context).push(
Navigator.of(context).push<void>(
CupertinoPageRoute(
builder: (context) => VeggieCategorySettingsScreen(),
title: 'Preferred Categories',

@ -69,12 +69,12 @@ class _ColorChangingIconState
}
@override
void forEachTween(visitor) {
void forEachTween(TweenVisitor<dynamic> visitor) {
_colorTween = visitor(
_colorTween,
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.footer,
}) : assert(items != null),
assert(items.length > 0);
assert(items.isNotEmpty);
final List<SettingsItem> items;
final Widget header;

@ -143,7 +143,7 @@ class VeggieCard extends StatelessWidget {
Widget build(BuildContext context) {
return PressableCard(
onPressed: () {
Navigator.of(context).push(CupertinoPageRoute(
Navigator.of(context).push<void>(CupertinoPageRoute(
builder: (context) => DetailsScreen(veggie.id),
fullscreenDialog: true,
));

@ -68,7 +68,7 @@ class VeggieHeadline extends StatelessWidget {
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () => Navigator.of(context).push(CupertinoPageRoute(
onTap: () => Navigator.of(context).push<void>(CupertinoPageRoute(
builder: (context) => DetailsScreen(veggie.id),
fullscreenDialog: true,
)),

@ -7,14 +7,14 @@ packages:
name: archive
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.8"
version: "2.0.10"
args:
dependency: transitive
description:
name: args
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.0"
version: "1.5.2"
async:
dependency: transitive
description:
@ -64,15 +64,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
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:
dependency: "direct main"
description: flutter
@ -84,7 +75,7 @@ packages:
name: flutter_launcher_icons
url: "https://pub.dartlang.org"
source: hosted
version: "0.7.0"
version: "0.7.2+1"
flutter_test:
dependency: "direct dev"
description: flutter
@ -103,14 +94,14 @@ packages:
name: image
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.7"
version: "2.1.4"
intl:
dependency: "direct main"
description:
name: intl
url: "https://pub.dartlang.org"
source: hosted
version: "0.15.7"
version: "0.15.8"
matcher:
dependency: transitive
description:
@ -133,7 +124,7 @@ packages:
source: hosted
version: "1.6.2"
pedantic:
dependency: transitive
dependency: "direct dev"
description:
name: pedantic
url: "https://pub.dartlang.org"
@ -145,7 +136,7 @@ packages:
name: petitparser
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
version: "2.2.1"
quiver:
dependency: transitive
description:
@ -166,7 +157,7 @@ packages:
name: shared_preferences
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.3"
version: "0.5.3+1"
sky_engine:
dependency: transitive
description: flutter
@ -234,14 +225,14 @@ packages:
name: xml
url: "https://pub.dartlang.org"
source: hosted
version: "3.3.1"
version: "3.4.1"
yaml:
dependency: transitive
description:
name: yaml
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.15"
version: "2.1.16"
sdks:
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
font_awesome_flutter: ^8.4.0
intl: ^0.15.7
intl: ^0.15.8
scoped_model: ^1.0.1
shared_preferences: ^0.4.3
shared_preferences: ^0.5.3+1
dev_dependencies:
flutter_test:
sdk: flutter
flutter_launcher_icons: ^0.7.0
pedantic: 1.5.0
flutter_launcher_icons: ^0.7.2+1
flutter:

@ -7,5 +7,5 @@
import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('This test always passes', (WidgetTester tester) async {});
testWidgets('This test always passes', (tester) async {});
}

Loading…
Cancel
Save