mirror of
https://github.com/flutter/samples.git
synced 2025-11-08 13:58:47 +00:00
Deps update, utilize super.key (#1265)
* Deps update, utilize `super.key` * `flutter format`
This commit is contained in:
@@ -49,7 +49,7 @@ void setupWindow() {
|
||||
}
|
||||
|
||||
class VeggieApp extends StatefulWidget {
|
||||
const VeggieApp({Key? key}) : super(key: key);
|
||||
const VeggieApp({super.key});
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() => _VeggieAppState();
|
||||
|
||||
@@ -12,7 +12,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, {super.key});
|
||||
|
||||
final Veggie veggie;
|
||||
|
||||
@@ -157,7 +157,7 @@ class ServingInfoChart extends StatelessWidget {
|
||||
class InfoView extends StatelessWidget {
|
||||
final int? id;
|
||||
|
||||
const InfoView(this.id, {Key? key}) : super(key: key);
|
||||
const InfoView(this.id, {super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -238,8 +238,7 @@ class DetailsScreen extends StatefulWidget {
|
||||
final int? id;
|
||||
final String? restorationId;
|
||||
|
||||
const DetailsScreen({this.id, this.restorationId, Key? key})
|
||||
: super(key: key);
|
||||
const DetailsScreen({this.id, this.restorationId, super.key});
|
||||
|
||||
static String show(NavigatorState navigator, int veggieId) {
|
||||
return navigator.restorablePush<void>(_routeBuilder, arguments: veggieId);
|
||||
|
||||
@@ -9,7 +9,7 @@ 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, super.key});
|
||||
|
||||
final String? restorationId;
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ 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({super.key, this.restorationId});
|
||||
|
||||
final String? restorationId;
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ 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, super.key});
|
||||
|
||||
final String? restorationId;
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ 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, super.key});
|
||||
|
||||
final String? restorationId;
|
||||
|
||||
|
||||
@@ -11,8 +11,7 @@ import 'package:veggieseasons/widgets/settings_group.dart';
|
||||
import 'package:veggieseasons/widgets/settings_item.dart';
|
||||
|
||||
class VeggieCategorySettingsScreen extends StatelessWidget {
|
||||
const VeggieCategorySettingsScreen({Key? key, this.restorationId})
|
||||
: super(key: key);
|
||||
const VeggieCategorySettingsScreen({super.key, this.restorationId});
|
||||
|
||||
final String? restorationId;
|
||||
|
||||
@@ -92,7 +91,7 @@ class VeggieCategorySettingsScreen extends StatelessWidget {
|
||||
}
|
||||
|
||||
class CalorieSettingsScreen extends StatelessWidget {
|
||||
const CalorieSettingsScreen({Key? key, this.restorationId}) : super(key: key);
|
||||
const CalorieSettingsScreen({super.key, this.restorationId});
|
||||
|
||||
final String? restorationId;
|
||||
|
||||
@@ -167,7 +166,7 @@ class CalorieSettingsScreen extends StatelessWidget {
|
||||
}
|
||||
|
||||
class SettingsScreen extends StatefulWidget {
|
||||
const SettingsScreen({this.restorationId, Key? key}) : super(key: key);
|
||||
const SettingsScreen({this.restorationId, super.key});
|
||||
|
||||
final String? restorationId;
|
||||
|
||||
|
||||
@@ -11,8 +11,8 @@ import 'package:veggieseasons/styles.dart';
|
||||
class FrostedBox extends StatelessWidget {
|
||||
const FrostedBox({
|
||||
this.child,
|
||||
Key? key,
|
||||
}) : super(key: key);
|
||||
super.key,
|
||||
});
|
||||
|
||||
final Widget? child;
|
||||
|
||||
@@ -36,9 +36,9 @@ class ColorChangingIcon extends ImplicitlyAnimatedWidget {
|
||||
this.icon, {
|
||||
this.color = CupertinoColors.black,
|
||||
this.size,
|
||||
required Duration duration,
|
||||
Key? key,
|
||||
}) : super(key: key, duration: duration);
|
||||
required super.duration,
|
||||
super.key,
|
||||
});
|
||||
|
||||
final Color color;
|
||||
|
||||
@@ -77,7 +77,7 @@ class _ColorChangingIconState
|
||||
|
||||
/// 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, {super.key});
|
||||
|
||||
final VoidCallback onPressed;
|
||||
|
||||
|
||||
@@ -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, {super.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, {super.key});
|
||||
|
||||
final String title;
|
||||
|
||||
@@ -58,9 +58,8 @@ class SettingsGroup extends StatelessWidget {
|
||||
required this.items,
|
||||
this.header,
|
||||
this.footer,
|
||||
Key? key,
|
||||
}) : assert(items.isNotEmpty),
|
||||
super(key: key);
|
||||
super.key,
|
||||
}) : assert(items.isNotEmpty);
|
||||
|
||||
final List<SettingsItem> items;
|
||||
final Widget? header;
|
||||
|
||||
@@ -16,7 +16,7 @@ import 'package:veggieseasons/styles.dart';
|
||||
typedef SettingsItemCallback = FutureOr<void> Function();
|
||||
|
||||
class SettingsNavigationIndicator extends StatelessWidget {
|
||||
const SettingsNavigationIndicator({Key? key}) : super(key: key);
|
||||
const SettingsNavigationIndicator({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -33,8 +33,8 @@ class SettingsIcon extends StatelessWidget {
|
||||
required this.icon,
|
||||
this.foregroundColor = CupertinoColors.white,
|
||||
this.backgroundColor = CupertinoColors.black,
|
||||
Key? key,
|
||||
}) : super(key: key);
|
||||
super.key,
|
||||
});
|
||||
|
||||
final Color backgroundColor;
|
||||
final Color foregroundColor;
|
||||
@@ -65,8 +65,8 @@ class SettingsItem extends StatefulWidget {
|
||||
this.content,
|
||||
this.subtitle,
|
||||
this.onPress,
|
||||
Key? key,
|
||||
}) : super(key: key);
|
||||
super.key,
|
||||
});
|
||||
|
||||
final String label;
|
||||
final Widget? icon;
|
||||
|
||||
@@ -10,7 +10,7 @@ class TriviaView extends StatefulWidget {
|
||||
final int? id;
|
||||
final String? restorationId;
|
||||
|
||||
const TriviaView({this.id, this.restorationId, Key? key}) : super(key: key);
|
||||
const TriviaView({this.id, this.restorationId, super.key});
|
||||
|
||||
@override
|
||||
State<TriviaView> createState() => _TriviaViewState();
|
||||
|
||||
@@ -14,8 +14,8 @@ class FrostyBackground extends StatelessWidget {
|
||||
this.color,
|
||||
this.intensity = 25,
|
||||
this.child,
|
||||
Key? key,
|
||||
}) : super(key: key);
|
||||
super.key,
|
||||
});
|
||||
|
||||
final Color? color;
|
||||
final double intensity;
|
||||
@@ -48,8 +48,8 @@ class PressableCard extends StatefulWidget {
|
||||
this.shadowColor = CupertinoColors.black,
|
||||
this.duration = const Duration(milliseconds: 100),
|
||||
this.onPressed,
|
||||
Key? key,
|
||||
}) : super(key: key);
|
||||
super.key,
|
||||
});
|
||||
|
||||
final VoidCallback? onPressed;
|
||||
|
||||
@@ -101,8 +101,7 @@ class _PressableCardState extends State<PressableCard> {
|
||||
|
||||
class VeggieCard extends StatelessWidget {
|
||||
const VeggieCard(this.veggie, this.isInSeason, this.isPreferredCategory,
|
||||
{Key? key})
|
||||
: super(key: key);
|
||||
{super.key});
|
||||
|
||||
/// Veggie to be displayed by the card.
|
||||
final Veggie veggie;
|
||||
|
||||
@@ -13,8 +13,8 @@ class ZoomClipAssetImage extends StatelessWidget {
|
||||
this.height,
|
||||
this.width,
|
||||
required this.imageAsset,
|
||||
Key? key,
|
||||
}) : super(key: key);
|
||||
super.key,
|
||||
});
|
||||
|
||||
final double zoom;
|
||||
final double? height;
|
||||
@@ -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, {super.key});
|
||||
|
||||
List<Widget> _buildSeasonDots(List<Season> seasons) {
|
||||
var widgets = <Widget>[];
|
||||
|
||||
Reference in New Issue
Block a user