Updated with more options

pull/98/head
Andrew Brogdon 7 years ago
parent 169c9f06f3
commit 710c6d0649

@ -1,9 +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

@ -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;
}
}

@ -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,
)),

@ -75,7 +75,7 @@ packages:
name: flutter_launcher_icons
url: "https://pub.dartlang.org"
source: hosted
version: "0.7.2"
version: "0.7.2+1"
flutter_test:
dependency: "direct dev"
description: flutter
@ -157,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
@ -235,4 +235,4 @@ packages:
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,16 +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
pedantic: 1.5.0
flutter_launcher_icons: ^0.7.0
flutter_launcher_icons: ^0.7.2+1
flutter:

Loading…
Cancel
Save