diff --git a/veggieseasons/ios/Podfile.lock b/veggieseasons/ios/Podfile.lock index 9d8f8aac2..524060c9b 100644 --- a/veggieseasons/ios/Podfile.lock +++ b/veggieseasons/ios/Podfile.lock @@ -15,8 +15,8 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a - shared_preferences: af6bfa751691cdc24be3045c43ec037377ada40d + shared_preferences: 5033afbb22d372e15aff8ff766df9021b845f273 PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c -COCOAPODS: 1.10.1 +COCOAPODS: 1.11.0 diff --git a/veggieseasons/lib/data/app_state.dart b/veggieseasons/lib/data/app_state.dart index 193a2911c..34261d64e 100644 --- a/veggieseasons/lib/data/app_state.dart +++ b/veggieseasons/lib/data/app_state.dart @@ -26,22 +26,22 @@ class AppState extends ChangeNotifier { return _veggies.where((v) => !v.seasons.contains(currentSeason)).toList(); } - Veggie getVeggie(int id) => _veggies.singleWhere((v) => v.id == id); + Veggie getVeggie(int? id) => _veggies.singleWhere((v) => v.id == id); - List searchVeggies(String terms) => _veggies - .where((v) => v.name.toLowerCase().contains(terms.toLowerCase())) + List searchVeggies(String? terms) => _veggies + .where((v) => v.name.toLowerCase().contains(terms!.toLowerCase())) .toList(); - void setFavorite(int id, bool isFavorite) { + void setFavorite(int? id, bool isFavorite) { var veggie = getVeggie(id); veggie.isFavorite = isFavorite; notifyListeners(); } /// Used in tests to set the season independent of the current date. - static Season debugCurrentSeason; + static Season? debugCurrentSeason; - static Season _getSeasonForDate(DateTime date) { + static Season? _getSeasonForDate(DateTime date) { if (debugCurrentSeason != null) { return debugCurrentSeason; } diff --git a/veggieseasons/lib/data/preferences.dart b/veggieseasons/lib/data/preferences.dart index f413a2293..67a6dd3fd 100644 --- a/veggieseasons/lib/data/preferences.dart +++ b/veggieseasons/lib/data/preferences.dart @@ -16,7 +16,7 @@ class Preferences extends ChangeNotifier { static const _preferredCategoriesKey = 'preferredCategories'; // Indicates whether a call to [_loadFromSharedPrefs] is in progress; - Future _loading; + Future? _loading; int _desiredCalories = 2000; @@ -79,9 +79,7 @@ class Preferences extends ChangeNotifier { if (names != null && names.isNotEmpty) { for (final name in names.split(',')) { final index = int.tryParse(name) ?? -1; - if (VeggieCategory.values[index] != null) { - _preferredCategories.add(VeggieCategory.values[index]); - } + _preferredCategories.add(VeggieCategory.values[index]); } } diff --git a/veggieseasons/lib/data/veggie.dart b/veggieseasons/lib/data/veggie.dart index 3161a6534..5b489a5c1 100644 --- a/veggieseasons/lib/data/veggie.dart +++ b/veggieseasons/lib/data/veggie.dart @@ -3,7 +3,6 @@ // found in the LICENSE file. import 'package:flutter/cupertino.dart'; -import 'package:meta/meta.dart'; enum VeggieCategory { allium, @@ -71,18 +70,18 @@ const Map seasonNames = { class Veggie { Veggie({ - @required this.id, - @required this.name, - @required this.imageAssetPath, - @required this.category, - @required this.shortDescription, - @required this.accentColor, - @required this.seasons, - @required this.vitaminAPercentage, - @required this.vitaminCPercentage, - @required this.servingSize, - @required this.caloriesPerServing, - @required this.trivia, + required this.id, + required this.name, + required this.imageAssetPath, + required this.category, + required this.shortDescription, + required this.accentColor, + required this.seasons, + required this.vitaminAPercentage, + required this.vitaminCPercentage, + required this.servingSize, + required this.caloriesPerServing, + required this.trivia, this.isFavorite = false, }); @@ -127,5 +126,5 @@ class Veggie { /// A set of trivia questions and answers related to the veggie. final List trivia; - String get categoryName => veggieCategoryNames[category]; + String? get categoryName => veggieCategoryNames[category]; } diff --git a/veggieseasons/lib/main.dart b/veggieseasons/lib/main.dart index e993ff29d..4d3ee879b 100644 --- a/veggieseasons/lib/main.dart +++ b/veggieseasons/lib/main.dart @@ -26,7 +26,7 @@ void main() { } class VeggieApp extends StatefulWidget { - const VeggieApp({Key key}) : super(key: key); + const VeggieApp({Key? key}) : super(key: key); @override State createState() => _VeggieAppState(); @@ -39,7 +39,7 @@ class _VeggieAppState extends State with RestorationMixin { String get restorationId => 'wrapper'; @override - void restoreState(RestorationBucket oldBucket, bool initialRestore) { + void restoreState(RestorationBucket? oldBucket, bool initialRestore) { registerForRestoration(_appState, 'state'); } @@ -77,7 +77,7 @@ class _RestorableAppState extends RestorableListenable { } @override - AppState fromPrimitives(Object data) { + AppState fromPrimitives(Object? data) { final appState = AppState(); final favorites = (data as List).cast(); for (var id in favorites) { diff --git a/veggieseasons/lib/screens/details.dart b/veggieseasons/lib/screens/details.dart index 283fb2c43..a1d343b51 100644 --- a/veggieseasons/lib/screens/details.dart +++ b/veggieseasons/lib/screens/details.dart @@ -13,7 +13,7 @@ import 'package:veggieseasons/widgets/close_button.dart'; import 'package:veggieseasons/widgets/trivia.dart'; class ServingInfoChart extends StatelessWidget { - const ServingInfoChart(this.veggie, this.prefs, {Key key}) : super(key: key); + const ServingInfoChart(this.veggie, this.prefs, {Key? key}) : super(key: key); final Veggie veggie; @@ -26,7 +26,7 @@ class ServingInfoChart extends StatelessWidget { return FutureBuilder( future: targetCalories, builder: (context, snapshot) { - final target = snapshot?.data ?? 2000; + final target = snapshot.data ?? 2000; final percent = standardPercentage * 2000 ~/ target; return Text( @@ -141,7 +141,7 @@ class ServingInfoChart extends StatelessWidget { builder: (context, snapshot) { return Text( 'Percent daily values based on a diet of ' - '${snapshot?.data ?? '2,000'} calories.', + '${snapshot.data ?? '2,000'} calories.', style: Styles.detailsServingNoteText(themeData), ); }, @@ -156,9 +156,9 @@ class ServingInfoChart extends StatelessWidget { } class InfoView extends StatelessWidget { - final int id; + final int? id; - const InfoView(this.id, {Key key}) : super(key: key); + const InfoView(this.id, {Key? key}) : super(key: key); @override Widget build(BuildContext context) { @@ -179,9 +179,9 @@ class InfoView extends StatelessWidget { future: prefs.preferredCategories, builder: (context, snapshot) { return Text( - veggie.categoryName.toUpperCase(), + veggie.categoryName!.toUpperCase(), style: (snapshot.hasData && - snapshot.data.contains(veggie.category)) + snapshot.data!.contains(veggie.category)) ? Styles.detailsPreferredCategoryText(themeData) : themeData.textTheme.textStyle, ); @@ -191,7 +191,7 @@ class InfoView extends StatelessWidget { for (Season season in veggie.seasons) ...[ const SizedBox(width: 12), Padding( - padding: Styles.seasonIconPadding[season], + padding: Styles.seasonIconPadding[season]!, child: Icon( Styles.seasonIconData[season], semanticLabel: seasonNames[season], @@ -236,17 +236,18 @@ class InfoView extends StatelessWidget { } class DetailsScreen extends StatefulWidget { - final int id; - final String restorationId; + final int? id; + final String? restorationId; - const DetailsScreen({this.id, this.restorationId, Key key}) : super(key: key); + const DetailsScreen({this.id, this.restorationId, Key? key}) + : super(key: key); static String show(NavigatorState navigator, int veggieId) { return navigator.restorablePush(_routeBuilder, arguments: veggieId); } - static Route _routeBuilder(BuildContext context, Object arguments) { - final veggieId = arguments as int; + static Route _routeBuilder(BuildContext context, Object? arguments) { + final veggieId = arguments as int?; return CupertinoPageRoute( builder: (context) => DetailsScreen(id: veggieId, restorationId: 'details'), @@ -262,10 +263,10 @@ class _DetailsScreenState extends State with RestorationMixin { final RestorableInt _selectedViewIndex = RestorableInt(0); @override - String get restorationId => widget.restorationId; + String? get restorationId => widget.restorationId; @override - void restoreState(RestorationBucket oldBucket, bool initialRestore) { + void restoreState(RestorationBucket? oldBucket, bool initialRestore) { registerForRestoration(_selectedViewIndex, 'tab'); } diff --git a/veggieseasons/lib/screens/favorites.dart b/veggieseasons/lib/screens/favorites.dart index 85081d41d..e76aaa84b 100644 --- a/veggieseasons/lib/screens/favorites.dart +++ b/veggieseasons/lib/screens/favorites.dart @@ -10,9 +10,9 @@ import 'package:veggieseasons/data/veggie.dart'; import 'package:veggieseasons/widgets/veggie_headline.dart'; class FavoritesScreen extends StatelessWidget { - const FavoritesScreen({this.restorationId, Key key}) : super(key: key); + const FavoritesScreen({this.restorationId, Key? key}) : super(key: key); - final String restorationId; + final String? restorationId; @override Widget build(BuildContext context) { diff --git a/veggieseasons/lib/screens/home.dart b/veggieseasons/lib/screens/home.dart index 8bcb9eb97..ca2e475cb 100644 --- a/veggieseasons/lib/screens/home.dart +++ b/veggieseasons/lib/screens/home.dart @@ -10,9 +10,9 @@ import 'package:veggieseasons/screens/search.dart'; import 'package:veggieseasons/screens/settings.dart'; class HomeScreen extends StatelessWidget { - const HomeScreen({Key key, this.restorationId}) : super(key: key); + const HomeScreen({Key? key, this.restorationId}) : super(key: key); - final String restorationId; + final String? restorationId; @override Widget build(BuildContext context) { diff --git a/veggieseasons/lib/screens/list.dart b/veggieseasons/lib/screens/list.dart index 1fca2eaa4..aee80d31e 100644 --- a/veggieseasons/lib/screens/list.dart +++ b/veggieseasons/lib/screens/list.dart @@ -14,9 +14,9 @@ import 'package:veggieseasons/styles.dart'; import 'package:veggieseasons/widgets/veggie_card.dart'; class ListScreen extends StatelessWidget { - const ListScreen({this.restorationId, Key key}) : super(key: key); + const ListScreen({this.restorationId, Key? key}) : super(key: key); - final String restorationId; + final String? restorationId; Widget _generateVeggieRow(Veggie veggie, Preferences prefs, {bool inSeason = true}) { diff --git a/veggieseasons/lib/screens/search.dart b/veggieseasons/lib/screens/search.dart index 3a659a7e0..b520d66fa 100644 --- a/veggieseasons/lib/screens/search.dart +++ b/veggieseasons/lib/screens/search.dart @@ -11,9 +11,9 @@ import 'package:veggieseasons/data/veggie.dart'; import 'package:veggieseasons/widgets/veggie_headline.dart'; class SearchScreen extends StatefulWidget { - const SearchScreen({this.restorationId, Key key}) : super(key: key); + const SearchScreen({this.restorationId, Key? key}) : super(key: key); - final String restorationId; + final String? restorationId; @override _SearchScreenState createState() => _SearchScreenState(); @@ -22,13 +22,13 @@ class SearchScreen extends StatefulWidget { class _SearchScreenState extends State with RestorationMixin { final controller = RestorableTextEditingController(); final focusNode = FocusNode(); - String terms; + String? terms; @override - String get restorationId => widget.restorationId; + String? get restorationId => widget.restorationId; @override - void restoreState(RestorationBucket oldBucket, bool initialRestore) { + void restoreState(RestorationBucket? oldBucket, bool initialRestore) { registerForRestoration(controller, 'text'); controller.addListener(_onTextChanged); terms = controller.value.text; diff --git a/veggieseasons/lib/screens/settings.dart b/veggieseasons/lib/screens/settings.dart index 79585ae44..2e136b65d 100644 --- a/veggieseasons/lib/screens/settings.dart +++ b/veggieseasons/lib/screens/settings.dart @@ -13,16 +13,16 @@ import 'package:veggieseasons/widgets/settings_group.dart'; import 'package:veggieseasons/widgets/settings_item.dart'; class VeggieCategorySettingsScreen extends StatelessWidget { - const VeggieCategorySettingsScreen({Key key, this.restorationId}) + const VeggieCategorySettingsScreen({Key? key, this.restorationId}) : super(key: key); - final String restorationId; + final String? restorationId; static String show(NavigatorState navigator) { return navigator.restorablePush(_routeBuilder); } - static Route _routeBuilder(BuildContext context, Object argument) { + static Route _routeBuilder(BuildContext context, Object? argument) { return CupertinoPageRoute( builder: (context) => const VeggieCategorySettingsScreen(restorationId: 'category'), @@ -56,7 +56,7 @@ class VeggieCategorySettingsScreen extends StatelessWidget { // otherwise. if (snapshot.hasData) { toggle = CupertinoSwitch( - value: snapshot.data.contains(category), + value: snapshot.data!.contains(category), onChanged: (value) { if (value) { model.addPreferredCategory(category); @@ -73,7 +73,7 @@ class VeggieCategorySettingsScreen extends StatelessWidget { } items.add(SettingsItem( - label: veggieCategoryNames[category], + label: veggieCategoryNames[category]!, content: toggle, )); } @@ -94,9 +94,9 @@ class VeggieCategorySettingsScreen extends StatelessWidget { } class CalorieSettingsScreen extends StatelessWidget { - const CalorieSettingsScreen({Key key, this.restorationId}) : super(key: key); + const CalorieSettingsScreen({Key? key, this.restorationId}) : super(key: key); - final String restorationId; + final String? restorationId; static const max = 1000; static const min = 2600; @@ -106,7 +106,7 @@ class CalorieSettingsScreen extends StatelessWidget { return navigator.restorablePush(_routeBuilder); } - static Route _routeBuilder(BuildContext context, Object argument) { + static Route _routeBuilder(BuildContext context, Object? argument) { return CupertinoPageRoute( builder: (context) => const CalorieSettingsScreen(restorationId: 'calorie'), @@ -169,9 +169,9 @@ class CalorieSettingsScreen extends StatelessWidget { } class SettingsScreen extends StatelessWidget { - const SettingsScreen({this.restorationId, Key key}) : super(key: key); + const SettingsScreen({this.restorationId, Key? key}) : super(key: key); - final String restorationId; + final String? restorationId; SettingsItem _buildCaloriesItem(BuildContext context, Preferences prefs) { return SettingsItem( diff --git a/veggieseasons/lib/styles.dart b/veggieseasons/lib/styles.dart index f81d9e2f1..03bfff303 100644 --- a/veggieseasons/lib/styles.dart +++ b/veggieseasons/lib/styles.dart @@ -115,7 +115,7 @@ abstract class Styles { static const appBackground = Color(0xffd0d0d0); - static Color scaffoldBackground(Brightness brightness) => + static Color? scaffoldBackground(Brightness brightness) => brightness == Brightness.light ? CupertinoColors.lightBackgroundGray : null; diff --git a/veggieseasons/lib/widgets/close_button.dart b/veggieseasons/lib/widgets/close_button.dart index 0c7bde80a..9c7521c6e 100644 --- a/veggieseasons/lib/widgets/close_button.dart +++ b/veggieseasons/lib/widgets/close_button.dart @@ -12,10 +12,10 @@ import 'package:veggieseasons/styles.dart'; class FrostedBox extends StatelessWidget { const FrostedBox({ this.child, - Key key, + Key? key, }) : super(key: key); - final Widget child; + final Widget? child; @override Widget build(BuildContext context) { @@ -37,18 +37,15 @@ class ColorChangingIcon extends ImplicitlyAnimatedWidget { this.icon, { this.color = CupertinoColors.black, this.size, - @required Duration duration, - Key key, - }) : assert(icon != null), - assert(color != null), - assert(duration != null), - super(key: key, duration: duration); + required Duration duration, + Key? key, + }) : super(key: key, duration: duration); final Color color; final IconData icon; - final double size; + final double? size; @override _ColorChangingIconState createState() => _ColorChangingIconState(); @@ -56,7 +53,7 @@ class ColorChangingIcon extends ImplicitlyAnimatedWidget { class _ColorChangingIconState extends AnimatedWidgetBaseState { - ColorTween _colorTween; + ColorTween? _colorTween; @override Widget build(BuildContext context) { @@ -73,14 +70,14 @@ class _ColorChangingIconState _colorTween = visitor( _colorTween, widget.color, - (dynamic value) => ColorTween(begin: value as Color), - ) as ColorTween; + (dynamic value) => ColorTween(begin: value as Color?), + ) as ColorTween?; } } /// A simple "close this modal" button that invokes a callback when pressed. class CloseButton extends StatefulWidget { - const CloseButton(this.onPressed, {Key key}) : super(key: key); + const CloseButton(this.onPressed, {Key? key}) : super(key: key); final VoidCallback onPressed; diff --git a/veggieseasons/lib/widgets/settings_group.dart b/veggieseasons/lib/widgets/settings_group.dart index 37b11e613..191f3135b 100644 --- a/veggieseasons/lib/widgets/settings_group.dart +++ b/veggieseasons/lib/widgets/settings_group.dart @@ -14,7 +14,7 @@ import 'settings_item.dart'; // See https://github.com/flutter/flutter/projects/29 for more info. class SettingsGroupHeader extends StatelessWidget { - const SettingsGroupHeader(this.title, {Key key}) : super(key: key); + const SettingsGroupHeader(this.title, {Key? key}) : super(key: key); final String title; @@ -35,7 +35,7 @@ class SettingsGroupHeader extends StatelessWidget { } class SettingsGroupFooter extends StatelessWidget { - const SettingsGroupFooter(this.title, {Key key}) : super(key: key); + const SettingsGroupFooter(this.title, {Key? key}) : super(key: key); final String title; @@ -55,17 +55,16 @@ class SettingsGroupFooter extends StatelessWidget { class SettingsGroup extends StatelessWidget { SettingsGroup({ - @required this.items, + required this.items, this.header, this.footer, - Key key, - }) : assert(items != null), - assert(items.isNotEmpty), + Key? key, + }) : assert(items.isNotEmpty), super(key: key); final List items; - final Widget header; - final Widget footer; + final Widget? header; + final Widget? footer; @override Widget build(BuildContext context) { var brightness = CupertinoTheme.brightnessOf(context); @@ -85,7 +84,7 @@ class SettingsGroup extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - if (header != null) header, + if (header != null) header!, Container( decoration: BoxDecoration( color: CupertinoColors.white, @@ -105,7 +104,7 @@ class SettingsGroup extends StatelessWidget { children: dividedItems, ), ), - if (footer != null) footer, + if (footer != null) footer!, ], ), ); diff --git a/veggieseasons/lib/widgets/settings_item.dart b/veggieseasons/lib/widgets/settings_item.dart index 3a81b90fd..761863e1f 100644 --- a/veggieseasons/lib/widgets/settings_item.dart +++ b/veggieseasons/lib/widgets/settings_item.dart @@ -16,7 +16,7 @@ import 'package:veggieseasons/styles.dart'; typedef SettingsItemCallback = FutureOr Function(); class SettingsNavigationIndicator extends StatelessWidget { - const SettingsNavigationIndicator({Key key}) : super(key: key); + const SettingsNavigationIndicator({Key? key}) : super(key: key); @override Widget build(BuildContext context) { @@ -30,12 +30,11 @@ class SettingsNavigationIndicator extends StatelessWidget { class SettingsIcon extends StatelessWidget { const SettingsIcon({ - @required this.icon, + required this.icon, this.foregroundColor = CupertinoColors.white, this.backgroundColor = CupertinoColors.black, - Key key, - }) : assert(icon != null), - super(key: key); + Key? key, + }) : super(key: key); final Color backgroundColor; final Color foregroundColor; @@ -61,20 +60,19 @@ class SettingsIcon extends StatelessWidget { class SettingsItem extends StatefulWidget { const SettingsItem({ - @required this.label, + required this.label, this.icon, this.content, this.subtitle, this.onPress, - Key key, - }) : assert(label != null), - super(key: key); + Key? key, + }) : super(key: key); final String label; - final Widget icon; - final Widget content; - final String subtitle; - final SettingsItemCallback onPress; + final Widget? icon; + final Widget? content; + final String? subtitle; + final SettingsItemCallback? onPress; @override State createState() => SettingsItemState(); @@ -97,7 +95,7 @@ class SettingsItemState extends State { setState(() { pressed = true; }); - await widget.onPress(); + await widget.onPress!(); Future.delayed( const Duration(milliseconds: 150), () { @@ -138,7 +136,7 @@ class SettingsItemState extends State { style: themeData.textTheme.textStyle), const SizedBox(height: 4), Text( - widget.subtitle, + widget.subtitle!, style: Styles.settingsItemSubtitleText(themeData), ), ], diff --git a/veggieseasons/lib/widgets/trivia.dart b/veggieseasons/lib/widgets/trivia.dart index 967c11e13..27f16328b 100644 --- a/veggieseasons/lib/widgets/trivia.dart +++ b/veggieseasons/lib/widgets/trivia.dart @@ -8,10 +8,10 @@ import 'package:veggieseasons/styles.dart'; /// Presents a series of trivia questions about a particular widget, and tracks /// the user's score. class TriviaView extends StatefulWidget { - final int id; - final String restorationId; + final int? id; + final String? restorationId; - const TriviaView({this.id, this.restorationId, Key key}) : super(key: key); + const TriviaView({this.id, this.restorationId, Key? key}) : super(key: key); @override _TriviaViewState createState() => _TriviaViewState(); @@ -26,10 +26,10 @@ enum PlayerStatus { class _TriviaViewState extends State with RestorationMixin { /// Current app state. This is used to fetch veggie data. - AppState appState; + late AppState appState; /// The veggie trivia about which to show. - Veggie veggie; + late Veggie veggie; /// Index of the current trivia question. RestorableInt triviaIndex = RestorableInt(0); @@ -45,10 +45,10 @@ class _TriviaViewState extends State with RestorationMixin { _RestorablePlayerStatus(PlayerStatus.readyToAnswer); @override - String get restorationId => widget.restorationId; + String? get restorationId => widget.restorationId; @override - void restoreState(RestorationBucket oldBucket, bool initialRestore) { + void restoreState(RestorationBucket? oldBucket, bool initialRestore) { registerForRestoration(triviaIndex, 'index'); registerForRestoration(score, 'score'); registerForRestoration(status, 'status'); @@ -234,7 +234,7 @@ class _RestorablePlayerStatus extends RestorableValue { } @override - PlayerStatus fromPrimitives(Object data) { + PlayerStatus fromPrimitives(Object? data) { return PlayerStatus.values[data as int]; } @@ -244,7 +244,7 @@ class _RestorablePlayerStatus extends RestorableValue { } @override - void didUpdateValue(PlayerStatus oldValue) { + void didUpdateValue(PlayerStatus? oldValue) { notifyListeners(); } } diff --git a/veggieseasons/lib/widgets/veggie_card.dart b/veggieseasons/lib/widgets/veggie_card.dart index 9c072e2dc..23bca42d8 100644 --- a/veggieseasons/lib/widgets/veggie_card.dart +++ b/veggieseasons/lib/widgets/veggie_card.dart @@ -14,12 +14,12 @@ class FrostyBackground extends StatelessWidget { this.color, this.intensity = 25, this.child, - Key key, + Key? key, }) : super(key: key); - final Color color; + final Color? color; final double intensity; - final Widget child; + final Widget? child; @override Widget build(BuildContext context) { @@ -41,23 +41,17 @@ class FrostyBackground extends StatelessWidget { /// elevation and invoking an optional [onPressed] callback. class PressableCard extends StatefulWidget { const PressableCard({ - @required this.child, + required this.child, this.borderRadius = const BorderRadius.all(Radius.circular(5)), this.upElevation = 2, this.downElevation = 0, this.shadowColor = CupertinoColors.black, this.duration = const Duration(milliseconds: 100), this.onPressed, - Key key, - }) : assert(child != null), - assert(borderRadius != null), - assert(upElevation != null), - assert(downElevation != null), - assert(shadowColor != null), - assert(duration != null), - super(key: key); + Key? key, + }) : super(key: key); - final VoidCallback onPressed; + final VoidCallback? onPressed; final Widget child; @@ -84,7 +78,7 @@ class _PressableCardState extends State { onTap: () { setState(() => cardIsDown = false); if (widget.onPressed != null) { - widget.onPressed(); + widget.onPressed!(); } }, onTapDown: (details) => setState(() => cardIsDown = true), @@ -107,7 +101,7 @@ class _PressableCardState extends State { class VeggieCard extends StatelessWidget { const VeggieCard(this.veggie, this.isInSeason, this.isPreferredCategory, - {Key key}) + {Key? key}) : super(key: key); /// Veggie to be displayed by the card. diff --git a/veggieseasons/lib/widgets/veggie_headline.dart b/veggieseasons/lib/widgets/veggie_headline.dart index 22aa37192..0ff7a909a 100644 --- a/veggieseasons/lib/widgets/veggie_headline.dart +++ b/veggieseasons/lib/widgets/veggie_headline.dart @@ -8,17 +8,17 @@ import 'package:veggieseasons/screens/details.dart'; import 'package:veggieseasons/styles.dart'; class ZoomClipAssetImage extends StatelessWidget { - const ZoomClipAssetImage( - {@required this.zoom, - this.height, - this.width, - @required this.imageAsset, - Key key}) - : super(key: key); + const ZoomClipAssetImage({ + required this.zoom, + this.height, + this.width, + required this.imageAsset, + Key? key, + }) : super(key: key); final double zoom; - final double height; - final double width; + final double? height; + final double? width; final String imageAsset; @override @@ -30,8 +30,8 @@ class ZoomClipAssetImage extends StatelessWidget { child: ClipRRect( borderRadius: BorderRadius.circular(10), child: OverflowBox( - maxHeight: height * zoom, - maxWidth: width * zoom, + maxHeight: height! * zoom, + maxWidth: width! * zoom, child: Image.asset( imageAsset, fit: BoxFit.fill, @@ -45,7 +45,7 @@ class ZoomClipAssetImage extends StatelessWidget { class VeggieHeadline extends StatelessWidget { final Veggie veggie; - const VeggieHeadline(this.veggie, {Key key}) : super(key: key); + const VeggieHeadline(this.veggie, {Key? key}) : super(key: key); List _buildSeasonDots(List seasons) { var widgets = []; diff --git a/veggieseasons/macos/Podfile.lock b/veggieseasons/macos/Podfile.lock index e93f18e31..2578211c1 100644 --- a/veggieseasons/macos/Podfile.lock +++ b/veggieseasons/macos/Podfile.lock @@ -19,4 +19,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 6eac6b3292e5142cfc23bdeb71848a40ec51c14c -COCOAPODS: 1.10.1 +COCOAPODS: 1.11.0 diff --git a/veggieseasons/pubspec.lock b/veggieseasons/pubspec.lock index 2f9ae2a92..82cfc0d28 100644 --- a/veggieseasons/pubspec.lock +++ b/veggieseasons/pubspec.lock @@ -21,7 +21,7 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.8.1" + version: "2.8.2" boolean_selector: dependency: transitive description: @@ -35,7 +35,7 @@ packages: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0" charcode: dependency: transitive description: @@ -162,7 +162,7 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.10" + version: "0.12.11" meta: dependency: transitive description: @@ -239,7 +239,7 @@ packages: name: provider url: "https://pub.dartlang.org" source: hosted - version: "5.0.0" + version: "6.0.1" shared_preferences: dependency: "direct main" description: @@ -328,7 +328,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.4.2" + version: "0.4.3" typed_data: dependency: transitive description: diff --git a/veggieseasons/pubspec.yaml b/veggieseasons/pubspec.yaml index 523451255..8f3664166 100644 --- a/veggieseasons/pubspec.yaml +++ b/veggieseasons/pubspec.yaml @@ -4,7 +4,7 @@ description: An iOS app that shows the fruits and veggies currently in season. version: 1.2.0 environment: - sdk: ">=2.5.0 <3.0.0" + sdk: '>=2.12.0 <3.0.0' dependencies: flutter: @@ -13,7 +13,7 @@ dependencies: cupertino_icons: ^1.0.2 font_awesome_flutter: ^9.0.0 intl: ^0.17.0 - provider: ^5.0.0 + provider: ^6.0.1 shared_preferences: ^2.0.5 dev_dependencies: