Unverified Commit 89b437e6 authored by Michael Goderbauer's avatar Michael Goderbauer Committed by GitHub

Prepare flutter_gallery for use_super_parameters (#100515)

parent bd6beb4e
......@@ -75,12 +75,10 @@ class _RenderStatusBarPaddingSliver extends RenderSliver {
class _StatusBarPaddingSliver extends SingleChildRenderObjectWidget {
const _StatusBarPaddingSliver({
Key? key,
required this.maxHeight,
this.scrollFactor = 5.0,
}) : assert(maxHeight >= 0.0),
assert(scrollFactor >= 1.0),
super(key: key);
assert(scrollFactor >= 1.0);
final double maxHeight;
final double scrollFactor;
......@@ -260,7 +258,6 @@ class _AllSectionsLayout extends MultiChildLayoutDelegate {
class _AllSectionsView extends AnimatedWidget {
_AllSectionsView({
Key? key,
required this.sectionIndex,
required this.sections,
required this.selectedIndex,
......@@ -271,7 +268,7 @@ class _AllSectionsView extends AnimatedWidget {
}) : assert(sectionCards.length == sections.length),
assert(sectionIndex >= 0 && sectionIndex < sections.length),
assert(selectedIndex.value! >= 0.0 && selectedIndex.value! < sections.length.toDouble()),
super(key: key, listenable: selectedIndex);
super(listenable: selectedIndex);
final int sectionIndex;
final List<Section> sections;
......@@ -361,9 +358,9 @@ class _AllSectionsView extends AnimatedWidget {
// visible.
class _SnappingScrollPhysics extends ClampingScrollPhysics {
const _SnappingScrollPhysics({
ScrollPhysics? parent,
super.parent,
required this.midScrollOffset,
}) : super(parent: parent);
});
final double midScrollOffset;
......@@ -415,7 +412,7 @@ class _SnappingScrollPhysics extends ClampingScrollPhysics {
}
class AnimationDemoHome extends StatefulWidget {
const AnimationDemoHome({ Key? key }) : super(key: key);
const AnimationDemoHome({ super.key });
static const String routeName = '/animation';
......
......@@ -10,8 +10,7 @@ const double kSectionIndicatorWidth = 32.0;
// The card for a single section. Displays the section's gradient and background image.
class SectionCard extends StatelessWidget {
const SectionCard({ Key? key, required this.section })
: super(key: key);
const SectionCard({ super.key, required this.section });
final Section section;
......@@ -45,12 +44,11 @@ class SectionCard extends StatelessWidget {
// offset a little. It's supposed to look sort-of 3D.
class SectionTitle extends StatelessWidget {
const SectionTitle({
Key? key,
super.key,
required this.section,
required this.scale,
required this.opacity,
}) : assert(opacity >= 0.0 && opacity <= 1.0),
super(key: key);
}) : assert(opacity >= 0.0 && opacity <= 1.0);
final Section section;
final double scale;
......@@ -94,7 +92,7 @@ class SectionTitle extends StatelessWidget {
// Small horizontal bar that indicates the selected section.
class SectionIndicator extends StatelessWidget {
const SectionIndicator({ Key? key, this.opacity = 1.0 }) : super(key: key);
const SectionIndicator({ super.key, this.opacity = 1.0 });
final double opacity;
......@@ -112,10 +110,9 @@ class SectionIndicator extends StatelessWidget {
// Display a single SectionDetail.
class SectionDetailView extends StatelessWidget {
SectionDetailView({ Key? key, required this.detail })
SectionDetailView({ super.key, required this.detail })
: assert(detail.imageAsset != null),
assert((detail.imageAsset ?? detail.title) != null),
super(key: key);
assert((detail.imageAsset ?? detail.title) != null);
final SectionDetail detail;
......
......@@ -7,7 +7,7 @@ import 'package:flutter/material.dart';
import 'animation/home.dart';
class AnimationDemo extends StatelessWidget {
const AnimationDemo({Key? key}) : super(key: key);
const AnimationDemo({super.key});
static const String routeName = '/animation';
......
......@@ -7,7 +7,7 @@ import 'package:flutter/material.dart';
import 'logic.dart';
class Calculator extends StatefulWidget {
const Calculator({Key? key}) : super(key: key);
const Calculator({super.key});
@override
State<Calculator> createState() => CalculatorState();
......@@ -138,7 +138,7 @@ class CalculatorState extends State<Calculator> {
}
class CalcDisplay extends StatelessWidget {
const CalcDisplay({ Key? key, this.content}) : super(key: key);
const CalcDisplay({ super.key, this.content});
final String? content;
......@@ -154,7 +154,7 @@ class CalcDisplay extends StatelessWidget {
}
class KeyPad extends StatelessWidget {
const KeyPad({ Key? key, this.calcState }) : super(key: key);
const KeyPad({ super.key, this.calcState });
final CalculatorState? calcState;
......@@ -222,7 +222,7 @@ class KeyPad extends StatelessWidget {
}
class KeyRow extends StatelessWidget {
const KeyRow(this.keys, {Key? key}) : super(key: key);
const KeyRow(this.keys, {super.key});
final List<Widget> keys;
......@@ -238,7 +238,7 @@ class KeyRow extends StatelessWidget {
}
class CalcKey extends StatelessWidget {
const CalcKey(this.text, this.onTap, {Key? key}) : super(key: key);
const CalcKey(this.text, this.onTap, {super.key});
final String text;
final GestureTapCallback onTap;
......
......@@ -17,7 +17,7 @@ class ExpressionToken {
/// A token that represents a number.
class NumberToken extends ExpressionToken {
NumberToken(String stringRep, this.number) : super(stringRep);
NumberToken(String super.stringRep, this.number);
NumberToken.fromNumber(num number) : this('$number', number);
......
......@@ -7,7 +7,7 @@ import 'package:flutter/material.dart';
import 'calculator/home.dart';
class CalculatorDemo extends StatelessWidget {
const CalculatorDemo({Key? key}) : super(key: key);
const CalculatorDemo({super.key});
static const String routeName = '/calculator';
......
......@@ -42,11 +42,11 @@ final List<Palette> allPalettes = <Palette>[
class ColorItem extends StatelessWidget {
const ColorItem({
Key? key,
super.key,
required this.index,
required this.color,
this.prefix = '',
}) : super(key: key);
});
final int index;
final Color color;
......@@ -80,10 +80,9 @@ class ColorItem extends StatelessWidget {
class PaletteTabView extends StatelessWidget {
PaletteTabView({
Key? key,
super.key,
required this.colors,
}) : assert(colors.isValid),
super(key: key);
}) : assert(colors.isValid);
final Palette colors;
......@@ -119,7 +118,7 @@ class PaletteTabView extends StatelessWidget {
}
class ColorsDemo extends StatelessWidget {
const ColorsDemo({Key? key}) : super(key: key);
const ColorsDemo({super.key});
static const String routeName = '/colors';
......
......@@ -6,7 +6,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
class _ContactCategory extends StatelessWidget {
const _ContactCategory({ Key? key, this.icon, this.children }) : super(key: key);
const _ContactCategory({ this.icon, this.children });
final IconData? icon;
final List<Widget>? children;
......@@ -42,9 +42,8 @@ class _ContactCategory extends StatelessWidget {
}
class _ContactItem extends StatelessWidget {
const _ContactItem({ Key? key, this.icon, required this.lines, this.tooltip, this.onPressed })
: assert(lines.length > 1),
super(key: key);
const _ContactItem({ this.icon, required this.lines, this.tooltip, this.onPressed })
: assert(lines.length > 1);
final IconData? icon;
final List<String> lines;
......@@ -86,7 +85,7 @@ class _ContactItem extends StatelessWidget {
}
class ContactsDemo extends StatefulWidget {
const ContactsDemo({Key? key}) : super(key: key);
const ContactsDemo({super.key});
static const String routeName = '/contacts';
......
......@@ -7,7 +7,7 @@ import 'package:flutter/cupertino.dart';
import '../../gallery/demo.dart';
class CupertinoProgressIndicatorDemo extends StatelessWidget {
const CupertinoProgressIndicatorDemo({Key? key}) : super(key: key);
const CupertinoProgressIndicatorDemo({super.key});
static const String routeName = '/cupertino/progress_indicator';
......
......@@ -7,7 +7,7 @@ import 'package:flutter/cupertino.dart';
import '../../gallery/demo.dart';
class CupertinoAlertDemo extends StatefulWidget {
const CupertinoAlertDemo({Key? key}) : super(key: key);
const CupertinoAlertDemo({super.key});
static const String routeName = '/cupertino/alert';
......@@ -198,7 +198,7 @@ class _CupertinoAlertDemoState extends State<CupertinoAlertDemo> {
}
class CupertinoDessertDialog extends StatelessWidget {
const CupertinoDessertDialog({Key? key, this.title, this.content}) : super(key: key);
const CupertinoDessertDialog({super.key, this.title, this.content});
final Widget? title;
final Widget? content;
......
......@@ -7,7 +7,7 @@ import 'package:flutter/cupertino.dart';
import '../../gallery/demo.dart';
class CupertinoButtonsDemo extends StatefulWidget {
const CupertinoButtonsDemo({Key? key}) : super(key: key);
const CupertinoButtonsDemo({super.key});
static const String routeName = '/cupertino/buttons';
......
......@@ -32,14 +32,13 @@ const List<String> coolColorNames = <String>[
const int _kChildCount = 50;
class CupertinoNavigationDemo extends StatelessWidget {
CupertinoNavigationDemo({ Key? key, this.randomSeed })
CupertinoNavigationDemo({ super.key, this.randomSeed })
: colorItems = List<Color>.generate(_kChildCount, (int index) {
return coolColors[math.Random(randomSeed).nextInt(coolColors.length)];
}) ,
colorNameItems = List<String>.generate(_kChildCount, (int index) {
return coolColorNames[math.Random(randomSeed).nextInt(coolColorNames.length)];
}),
super(key: key);
});
static const String routeName = '/cupertino/navigation';
......@@ -105,7 +104,7 @@ class CupertinoNavigationDemo extends StatelessWidget {
}
class ExitButton extends StatelessWidget {
const ExitButton({Key? key}) : super(key: key);
const ExitButton({super.key});
@override
Widget build(BuildContext context) {
......@@ -135,11 +134,11 @@ final Widget trailingButtons = Row(
class CupertinoDemoTab1 extends StatelessWidget {
const CupertinoDemoTab1({
Key? key,
super.key,
this.colorItems,
this.colorNameItems,
this.randomSeed,
}) : super(key: key);
});
final List<Color>? colorItems;
final List<String>? colorNameItems;
......@@ -186,13 +185,13 @@ class CupertinoDemoTab1 extends StatelessWidget {
class Tab1RowItem extends StatelessWidget {
const Tab1RowItem({
Key? key,
super.key,
this.index,
this.lastItem,
this.color,
this.colorName,
this.randomSeed,
}) : super(key: key);
});
final int? index;
final bool? lastItem;
......@@ -290,7 +289,7 @@ class Tab1RowItem extends StatelessWidget {
}
class Tab1ItemPage extends StatefulWidget {
const Tab1ItemPage({Key? key, this.color, this.colorName, this.index, this.randomSeed}) : super(key: key);
const Tab1ItemPage({super.key, this.color, this.colorName, this.index, this.randomSeed});
final Color? color;
final String? colorName;
......@@ -437,7 +436,7 @@ class Tab1ItemPageState extends State<Tab1ItemPage> {
}
class CupertinoDemoTab2 extends StatelessWidget {
const CupertinoDemoTab2({Key? key}) : super(key: key);
const CupertinoDemoTab2({super.key});
@override
Widget build(BuildContext context) {
......@@ -461,7 +460,7 @@ class CupertinoDemoTab2 extends StatelessWidget {
}
class Tab2Header extends StatelessWidget {
const Tab2Header({Key? key}) : super(key: key);
const Tab2Header({super.key});
@override
Widget build(BuildContext context) {
......@@ -589,7 +588,7 @@ enum Tab2ConversationBubbleColor {
}
class Tab2ConversationBubble extends StatelessWidget {
const Tab2ConversationBubble({Key? key, this.text, this.color}) : super(key: key);
const Tab2ConversationBubble({super.key, this.text, this.color});
final String? text;
final Tab2ConversationBubbleColor? color;
......@@ -633,7 +632,7 @@ class Tab2ConversationBubble extends StatelessWidget {
}
class Tab2ConversationAvatar extends StatelessWidget {
const Tab2ConversationAvatar({Key? key, this.text, this.color}) : super(key: key);
const Tab2ConversationAvatar({super.key, this.text, this.color});
final String? text;
final Color? color;
......@@ -672,7 +671,7 @@ class Tab2ConversationAvatar extends StatelessWidget {
}
class Tab2ConversationRow extends StatelessWidget {
const Tab2ConversationRow({Key? key, this.avatar, this.text}) : super(key: key);
const Tab2ConversationRow({super.key, this.avatar, this.text});
final Tab2ConversationAvatar? avatar;
final String? text;
......@@ -742,7 +741,7 @@ List<Widget> buildTab2Conversation() {
}
class CupertinoDemoTab3 extends StatelessWidget {
const CupertinoDemoTab3({Key? key}) : super(key: key);
const CupertinoDemoTab3({super.key});
@override
Widget build(BuildContext context) {
......@@ -794,7 +793,7 @@ class CupertinoDemoTab3 extends StatelessWidget {
}
class Tab3Dialog extends StatelessWidget {
const Tab3Dialog({Key? key}) : super(key: key);
const Tab3Dialog({super.key});
@override
Widget build(BuildContext context) {
......
......@@ -12,7 +12,7 @@ const double _kPickerSheetHeight = 216.0;
const double _kPickerItemHeight = 32.0;
class CupertinoPickerDemo extends StatefulWidget {
const CupertinoPickerDemo({Key? key}) : super(key: key);
const CupertinoPickerDemo({super.key});
static const String routeName = '/cupertino/picker';
......@@ -22,9 +22,8 @@ class CupertinoPickerDemo extends StatefulWidget {
class _BottomPicker extends StatelessWidget {
const _BottomPicker({
Key? key,
required this.child,
}) : super(key: key);
});
final Widget child;
......@@ -54,9 +53,8 @@ class _BottomPicker extends StatelessWidget {
class _Menu extends StatelessWidget {
const _Menu({
Key? key,
required this.children,
}) : super(key: key);
});
final List<Widget> children;
......
......@@ -9,7 +9,7 @@ import 'package:flutter/cupertino.dart';
import '../../gallery/demo.dart';
class CupertinoRefreshControlDemo extends StatefulWidget {
const CupertinoRefreshControlDemo({Key? key}) : super(key: key);
const CupertinoRefreshControlDemo({super.key});
static const String routeName = '/cupertino/refresh';
......
......@@ -12,7 +12,7 @@ const Color _kKeyPenumbraOpacity = Color(0x24000000); // alpha = 0.14
const Color _kAmbientShadowOpacity = Color(0x1F000000); // alpha = 0.12
class CupertinoSegmentedControlDemo extends StatefulWidget {
const CupertinoSegmentedControlDemo({Key? key}) : super(key: key);
const CupertinoSegmentedControlDemo({super.key});
static const String routeName = 'cupertino/segmented_control';
......
......@@ -7,7 +7,7 @@ import 'package:flutter/cupertino.dart';
import '../../gallery/demo.dart';
class CupertinoSliderDemo extends StatefulWidget {
const CupertinoSliderDemo({Key? key}) : super(key: key);
const CupertinoSliderDemo({super.key});
static const String routeName = '/cupertino/slider';
......
......@@ -7,7 +7,7 @@ import 'package:flutter/cupertino.dart';
import '../../gallery/demo.dart';
class CupertinoSwitchDemo extends StatefulWidget {
const CupertinoSwitchDemo({Key? key}) : super(key: key);
const CupertinoSwitchDemo({super.key});
static const String routeName = '/cupertino/switch';
......
......@@ -5,7 +5,7 @@
import 'package:flutter/cupertino.dart';
class CupertinoTextFieldDemo extends StatefulWidget {
const CupertinoTextFieldDemo({Key? key}) : super(key: key);
const CupertinoTextFieldDemo({super.key});
static const String routeName = '/cupertino/text_fields';
......
......@@ -5,7 +5,7 @@
import 'package:flutter/material.dart';
class FortnightlyDemo extends StatelessWidget {
const FortnightlyDemo({Key? key}) : super(key: key);
const FortnightlyDemo({super.key});
static const String routeName = '/fortnightly';
......@@ -33,7 +33,7 @@ class FortnightlyDemo extends StatelessWidget {
}
class ShortAppBar extends StatelessWidget {
const ShortAppBar({ Key? key, this.onBackPressed }) : super(key: key);
const ShortAppBar({ super.key, this.onBackPressed });
final VoidCallback? onBackPressed;
......@@ -68,7 +68,7 @@ class ShortAppBar extends StatelessWidget {
}
class FruitPage extends StatelessWidget {
const FruitPage({Key? key}) : super(key: key);
const FruitPage({super.key});
static final String paragraph1 = '''
Have you ever held a quince? It's strange;
......
......@@ -7,7 +7,7 @@ import 'package:flutter/material.dart';
import '../gallery/demo.dart';
class ImagesDemo extends StatelessWidget {
const ImagesDemo({Key? key}) : super(key: key);
const ImagesDemo({super.key});
static const String routeName = '/images';
......
......@@ -95,7 +95,7 @@ const List<Category> allCategories = <Category>[
];
class CategoryView extends StatelessWidget {
const CategoryView({ Key? key, this.category }) : super(key: key);
const CategoryView({ super.key, this.category });
final Category? category;
......@@ -149,13 +149,13 @@ class CategoryView extends StatelessWidget {
// BackdropDemo.
class BackdropPanel extends StatelessWidget {
const BackdropPanel({
Key? key,
super.key,
this.onTap,
this.onVerticalDragUpdate,
this.onVerticalDragEnd,
this.title,
this.child,
}) : super(key: key);
});
final VoidCallback? onTap;
final GestureDragUpdateCallback? onVerticalDragUpdate;
......@@ -204,9 +204,9 @@ class BackdropPanel extends StatelessWidget {
// Cross fades between 'Select a Category' and 'Asset Viewer'.
class BackdropTitle extends AnimatedWidget {
const BackdropTitle({
Key? key,
required Animation<double> listenable,
}) : super(key: key, listenable: listenable);
super.key,
required Animation<double> super.listenable,
});
@override
Widget build(BuildContext context) {
......@@ -239,7 +239,7 @@ class BackdropTitle extends AnimatedWidget {
// This widget is essentially the backdrop itself.
class BackdropDemo extends StatefulWidget {
const BackdropDemo({Key? key}) : super(key: key);
const BackdropDemo({super.key});
static const String routeName = '/material/backdrop';
......
......@@ -13,7 +13,7 @@ enum BannerDemoAction {
}
class BannerDemo extends StatefulWidget {
const BannerDemo({ Key? key }) : super(key: key);
const BannerDemo({ super.key });
static const String routeName = '/material/banner';
......
......@@ -7,7 +7,7 @@ import 'package:flutter/material.dart';
import '../../gallery/demo.dart';
class BottomAppBarDemo extends StatefulWidget {
const BottomAppBarDemo({Key? key}) : super(key: key);
const BottomAppBarDemo({super.key});
static const String routeName = '/material/bottom_app_bar';
......
......@@ -75,7 +75,7 @@ class NavigationIconView {
}
class CustomIcon extends StatelessWidget {
const CustomIcon({Key? key}) : super(key: key);
const CustomIcon({super.key});
@override
Widget build(BuildContext context) {
......@@ -90,7 +90,7 @@ class CustomIcon extends StatelessWidget {
}
class CustomInactiveIcon extends StatelessWidget {
const CustomInactiveIcon({Key? key}) : super(key: key);
const CustomInactiveIcon({super.key});
@override
Widget build(BuildContext context) {
......@@ -107,7 +107,7 @@ class CustomInactiveIcon extends StatelessWidget {
}
class BottomNavigationDemo extends StatefulWidget {
const BottomNavigationDemo({Key? key}) : super(key: key);
const BottomNavigationDemo({super.key});
static const String routeName = '/material/bottom_navigation';
......
......@@ -46,7 +46,7 @@ const String _actionText =
const String _actionCode = 'buttons_action';
class ButtonsDemo extends StatefulWidget {
const ButtonsDemo({Key? key}) : super(key: key);
const ButtonsDemo({super.key});
static const String routeName = '/material/buttons';
......
......@@ -64,8 +64,7 @@ const List<TravelDestination> destinations = <TravelDestination>[
];
class TravelDestinationItem extends StatelessWidget {
const TravelDestinationItem({ Key? key, required this.destination, this.shape })
: super(key: key);
const TravelDestinationItem({ super.key, required this.destination, this.shape });
// This height will allow for all the Card's content to fit comfortably within the card.
static const double height = 338.0;
......@@ -99,8 +98,7 @@ class TravelDestinationItem extends StatelessWidget {
}
class TappableTravelDestinationItem extends StatelessWidget {
const TappableTravelDestinationItem({ Key? key, required this.destination, this.shape })
: super(key: key);
const TappableTravelDestinationItem({ super.key, required this.destination, this.shape });
// This height will allow for all the Card's content to fit comfortably within the card.
static const double height = 298.0;
......@@ -143,8 +141,7 @@ class TappableTravelDestinationItem extends StatelessWidget {
}
class SelectableTravelDestinationItem extends StatefulWidget {
const SelectableTravelDestinationItem({ Key? key, required this.destination, this.shape })
: super(key: key);
const SelectableTravelDestinationItem({ super.key, required this.destination, this.shape });
final TravelDestination destination;
final ShapeBorder? shape;
......@@ -222,9 +219,9 @@ class _SelectableTravelDestinationItemState extends State<SelectableTravelDestin
class SectionTitle extends StatelessWidget {
const SectionTitle({
Key? key,
super.key,
this.title,
}) : super(key: key);
});
final String? title;
......@@ -241,8 +238,7 @@ class SectionTitle extends StatelessWidget {
}
class TravelDestinationContent extends StatelessWidget {
const TravelDestinationContent({ Key? key, required this.destination })
: super(key: key);
const TravelDestinationContent({ super.key, required this.destination });
final TravelDestination destination;
......@@ -339,7 +335,7 @@ class TravelDestinationContent extends StatelessWidget {
}
class CardsDemo extends StatefulWidget {
const CardsDemo({Key? key}) : super(key: key);
const CardsDemo({super.key});
static const String routeName = '/material/cards';
......
......@@ -88,10 +88,9 @@ const Map<String, Set<String>> _materialActions = <String, Set<String>>{
class _ChipsTile extends StatelessWidget {
const _ChipsTile({
Key? key,
this.label,
this.children,
}) : super(key: key);
});
final String? label;
final List<Widget>? children;
......@@ -135,7 +134,7 @@ class _ChipsTile extends StatelessWidget {
}
class ChipDemo extends StatefulWidget {
const ChipDemo({Key? key}) : super(key: key);
const ChipDemo({super.key});
static const String routeName = '/material/chip';
......
......@@ -142,7 +142,7 @@ class DessertDataSource extends DataTableSource {
}
class DataTableDemo extends StatefulWidget {
const DataTableDemo({Key? key}) : super(key: key);
const DataTableDemo({super.key});
static const String routeName = '/material/data-table';
......
......@@ -9,12 +9,11 @@ import '../../gallery/demo.dart';
class _InputDropdown extends StatelessWidget {
const _InputDropdown({
Key? key,
this.labelText,
this.valueText,
this.valueStyle,
this.onPressed,
}) : super(key: key);
});
final String? labelText;
final String? valueText;
......@@ -47,13 +46,12 @@ class _InputDropdown extends StatelessWidget {
class _DateTimePicker extends StatelessWidget {
const _DateTimePicker({
Key? key,
this.labelText,
this.selectedDate,
this.selectedTime,
this.selectDate,
this.selectTime,
}) : super(key: key);
});
final String? labelText;
final DateTime? selectedDate;
......@@ -111,7 +109,7 @@ class _DateTimePicker extends StatelessWidget {
}
class DateAndTimePickerDemo extends StatefulWidget {
const DateAndTimePickerDemo({Key? key}) : super(key: key);
const DateAndTimePickerDemo({super.key});
static const String routeName = '/material/date-and-time-pickers';
......
......@@ -21,7 +21,7 @@ const String _alertWithTitleText =
'data to Google, even when no apps are running.';
class DialogDemoItem extends StatelessWidget {
const DialogDemoItem({ Key? key, this.icon, this.color, this.text, this.onPressed }) : super(key: key);
const DialogDemoItem({ super.key, this.icon, this.color, this.text, this.onPressed });
final IconData? icon;
final Color? color;
......@@ -46,7 +46,7 @@ class DialogDemoItem extends StatelessWidget {
}
class DialogDemo extends StatefulWidget {
const DialogDemo({Key? key}) : super(key: key);
const DialogDemo({super.key});
static const String routeName = '/material/dialog';
......
......@@ -13,7 +13,7 @@ const String _kAsset2 = 'people/square/sandra.png';
const String _kGalleryAssetsPackage = 'flutter_gallery_assets';
class DrawerDemo extends StatefulWidget {
const DrawerDemo({Key? key}) : super(key: key);
const DrawerDemo({super.key});
static const String routeName = '/material/drawer';
......
......@@ -7,7 +7,7 @@ import 'package:flutter/material.dart';
import '../../gallery/demo.dart';
class ElevationDemo extends StatefulWidget {
const ElevationDemo({Key? key}) : super(key: key);
const ElevationDemo({super.key});
static const String routeName = '/material/elevation';
......
......@@ -18,12 +18,12 @@ typedef ValueToString<T> = String? Function(T value);
class DualHeaderWithHint extends StatelessWidget {
const DualHeaderWithHint({
Key? key,
super.key,
this.name,
this.value,
this.hint,
this.showHint,
}) : super(key: key);
});
final String? name;
final String? value;
......@@ -81,12 +81,12 @@ class DualHeaderWithHint extends StatelessWidget {
class CollapsibleBody extends StatelessWidget {
const CollapsibleBody({
Key? key,
super.key,
this.margin = EdgeInsets.zero,
this.child,
this.onSave,
this.onCancel,
}) : super(key: key);
});
final EdgeInsets margin;
final Widget? child;
......@@ -177,7 +177,7 @@ class DemoItem<T> {
}
class ExpansionPanelsDemo extends StatefulWidget {
const ExpansionPanelsDemo({Key? key}) : super(key: key);
const ExpansionPanelsDemo({super.key});
static const String routeName = '/material/expansion_panels';
......
......@@ -7,7 +7,7 @@ import 'package:flutter/material.dart';
import '../../gallery/demo.dart';
class ExpansionTileListDemo extends StatelessWidget {
const ExpansionTileListDemo({Key? key}) : super(key: key);
const ExpansionTileListDemo({super.key});
static const String routeName = '/material/expansion-tile-list';
......
......@@ -15,10 +15,9 @@ enum DismissDialogAction {
}
class DateTimeItem extends StatelessWidget {
DateTimeItem({ Key? key, required DateTime dateTime, required this.onChanged })
DateTimeItem({ super.key, required DateTime dateTime, required this.onChanged })
: date = DateTime(dateTime.year, dateTime.month, dateTime.day),
time = TimeOfDay(hour: dateTime.hour, minute: dateTime.minute),
super(key: key);
time = TimeOfDay(hour: dateTime.hour, minute: dateTime.minute);
final DateTime date;
final TimeOfDay time;
......@@ -93,7 +92,7 @@ class DateTimeItem extends StatelessWidget {
}
class FullScreenDialogDemo extends StatefulWidget {
const FullScreenDialogDemo({Key? key}) : super(key: key);
const FullScreenDialogDemo({super.key});
@override
FullScreenDialogDemoState createState() => FullScreenDialogDemoState();
......
......@@ -38,7 +38,7 @@ class Photo {
}
class GridPhotoViewer extends StatefulWidget {
const GridPhotoViewer({ Key? key, this.photo }) : super(key: key);
const GridPhotoViewer({ super.key, this.photo });
final Photo? photo;
......@@ -155,12 +155,11 @@ class _GridPhotoViewerState extends State<GridPhotoViewer> with SingleTickerProv
class GridDemoPhotoItem extends StatelessWidget {
GridDemoPhotoItem({
Key? key,
super.key,
required this.photo,
required this.tileStyle,
required this.onBannerTap,
}) : assert(photo.isValid),
super(key: key);
}) : assert(photo.isValid);
final Photo photo;
final GridDemoTileStyle tileStyle;
......@@ -245,7 +244,7 @@ class GridDemoPhotoItem extends StatelessWidget {
}
class GridListDemo extends StatefulWidget {
const GridListDemo({ Key? key }) : super(key: key);
const GridListDemo({ super.key });
static const String routeName = '/material/grid-list';
......
......@@ -7,7 +7,7 @@ import 'package:flutter/material.dart';
import '../../gallery/demo.dart';
class IconsDemo extends StatefulWidget {
const IconsDemo({Key? key}) : super(key: key);
const IconsDemo({super.key});
static const String routeName = '/material/icons';
......
......@@ -33,7 +33,7 @@ class LeaveBehindItem implements Comparable<LeaveBehindItem> {
}
class LeaveBehindDemo extends StatefulWidget {
const LeaveBehindDemo({ Key? key }) : super(key: key);
const LeaveBehindDemo({ super.key });
static const String routeName = '/material/leave-behind';
......@@ -188,13 +188,12 @@ class LeaveBehindDemoState extends State<LeaveBehindDemo> {
class _LeaveBehindListItem extends StatelessWidget {
const _LeaveBehindListItem({
Key? key,
required this.item,
required this.onArchive,
required this.onDelete,
required this.dismissDirection,
required this.confirmDismiss,
}) : super(key: key);
});
final LeaveBehindItem item;
final DismissDirection dismissDirection;
......
......@@ -21,7 +21,7 @@ enum _MaterialListType {
}
class ListDemo extends StatefulWidget {
const ListDemo({ Key? key }) : super(key: key);
const ListDemo({ super.key });
static const String routeName = '/material/list';
......
......@@ -7,7 +7,7 @@ import 'package:flutter/material.dart';
import '../../gallery/demo.dart';
class MenuDemo extends StatefulWidget {
const MenuDemo({ Key? key }) : super(key: key);
const MenuDemo({ super.key });
static const String routeName = '/material/menu';
......
......@@ -7,7 +7,7 @@ import 'package:flutter/material.dart';
import '../../gallery/demo.dart';
class ModalBottomSheetDemo extends StatelessWidget {
const ModalBottomSheetDemo({Key? key}) : super(key: key);
const ModalBottomSheetDemo({super.key});
static const String routeName = '/material/modal-bottom-sheet';
......
......@@ -11,7 +11,7 @@ import '../../gallery/demo.dart';
enum IndicatorType { overscroll, refresh }
class OverscrollDemo extends StatefulWidget {
const OverscrollDemo({ Key? key }) : super(key: key);
const OverscrollDemo({ super.key });
static const String routeName = '/material/overscroll';
......
......@@ -74,7 +74,7 @@ class _PageSelector extends StatelessWidget {
}
class PageSelectorDemo extends StatelessWidget {
const PageSelectorDemo({Key? key}) : super(key: key);
const PageSelectorDemo({super.key});
static const String routeName = '/material/page-selector';
static final List<Icon> icons = <Icon>[
......
......@@ -7,7 +7,7 @@ import 'package:flutter/material.dart';
import '../../gallery/demo.dart';
class PersistentBottomSheetDemo extends StatefulWidget {
const PersistentBottomSheetDemo({Key? key}) : super(key: key);
const PersistentBottomSheetDemo({super.key});
static const String routeName = '/material/persistent-bottom-sheet';
......
......@@ -7,7 +7,7 @@ import 'package:flutter/material.dart';
import '../../gallery/demo.dart';
class ProgressIndicatorDemo extends StatefulWidget {
const ProgressIndicatorDemo({Key? key}) : super(key: key);
const ProgressIndicatorDemo({super.key});
static const String routeName = '/material/progress-indicator';
......
......@@ -18,7 +18,7 @@ enum _ReorderableListType {
}
class ReorderableListDemo extends StatefulWidget {
const ReorderableListDemo({ Key? key }) : super(key: key);
const ReorderableListDemo({ super.key });
static const String routeName = '/material/reorderable-list';
......
......@@ -36,7 +36,7 @@ const List<_Page> _allPages = <_Page>[
];
class ScrollableTabsDemo extends StatefulWidget {
const ScrollableTabsDemo({Key? key}) : super(key: key);
const ScrollableTabsDemo({super.key});
static const String routeName = '/material/scrollable-tabs';
......
......@@ -7,7 +7,7 @@ import 'package:flutter/material.dart';
import '../../gallery/demo.dart';
class SearchDemo extends StatefulWidget {
const SearchDemo({Key? key}) : super(key: key);
const SearchDemo({super.key});
static const String routeName = '/material/search';
......
......@@ -28,7 +28,7 @@ const String _switchText =
const String _switchCode = 'selectioncontrols_switch';
class SelectionControlsDemo extends StatefulWidget {
const SelectionControlsDemo({Key? key}) : super(key: key);
const SelectionControlsDemo({super.key});
static const String routeName = '/material/selection-controls';
......
......@@ -9,7 +9,7 @@ import 'package:flutter/material.dart';
import '../../gallery/demo.dart';
class SliderDemo extends StatefulWidget {
const SliderDemo({Key? key}) : super(key: key);
const SliderDemo({super.key});
static const String routeName = '/material/slider';
......
......@@ -19,7 +19,7 @@ const String _text3 =
'By default snackbars automatically disappear after a few seconds ';
class SnackBarDemo extends StatefulWidget {
const SnackBarDemo({ Key? key }) : super(key: key);
const SnackBarDemo({ super.key });
static const String routeName = '/material/snack-bar';
......
......@@ -137,7 +137,7 @@ class _CardDataItem extends StatelessWidget {
}
class TabsDemo extends StatelessWidget {
const TabsDemo({Key? key}) : super(key: key);
const TabsDemo({super.key});
static const String routeName = '/material/tabs';
......
......@@ -35,7 +35,7 @@ final List<_Page> _allPages = <_Page>[
];
class TabsFabDemo extends StatefulWidget {
const TabsFabDemo({Key? key}) : super(key: key);
const TabsFabDemo({super.key});
static const String routeName = '/material/tabs-fab';
......
......@@ -9,7 +9,7 @@ import 'package:flutter/services.dart';
import '../../gallery/demo.dart';
class TextFormFieldDemo extends StatefulWidget {
const TextFormFieldDemo({ Key? key }) : super(key: key);
const TextFormFieldDemo({ super.key });
static const String routeName = '/material/text-form-field';
......@@ -26,7 +26,7 @@ class PersonData {
class PasswordField extends StatefulWidget {
const PasswordField({
Key? key,
super.key,
this.fieldKey,
this.hintText,
this.labelText,
......@@ -34,7 +34,7 @@ class PasswordField extends StatefulWidget {
this.onSaved,
this.validator,
this.onFieldSubmitted,
}) : super(key: key);
});
final Key? fieldKey;
final String? hintText;
......
......@@ -12,7 +12,7 @@ const String _introText =
'apps accessible, like screen readers.';
class TooltipDemo extends StatelessWidget {
const TooltipDemo({Key? key}) : super(key: key);
const TooltipDemo({super.key});
static const String routeName = '/material/tooltips';
......
......@@ -5,7 +5,7 @@
import 'package:flutter/material.dart';
class PestoDemo extends StatelessWidget {
const PestoDemo({ Key? key }) : super(key: key);
const PestoDemo({ super.key });
static const String routeName = '/pesto';
......@@ -28,7 +28,7 @@ final ThemeData _kTheme = ThemeData(
);
class PestoHome extends StatelessWidget {
const PestoHome({Key? key}) : super(key: key);
const PestoHome({super.key});
@override
Widget build(BuildContext context) {
......@@ -37,7 +37,7 @@ class PestoHome extends StatelessWidget {
}
class PestoFavorites extends StatelessWidget {
const PestoFavorites({Key? key}) : super(key: key);
const PestoFavorites({super.key});
@override
Widget build(BuildContext context) {
......@@ -47,26 +47,21 @@ class PestoFavorites extends StatelessWidget {
class PestoStyle extends TextStyle {
const PestoStyle({
double fontSize = 12.0,
FontWeight? fontWeight,
Color color = Colors.black87,
double? letterSpacing,
double? height,
double super.fontSize = 12.0,
super.fontWeight,
Color super.color = Colors.black87,
super.letterSpacing,
super.height,
}) : super(
inherit: false,
color: color,
fontFamily: 'Raleway',
fontSize: fontSize,
fontWeight: fontWeight,
textBaseline: TextBaseline.alphabetic,
letterSpacing: letterSpacing,
height: height,
);
}
// Displays a grid of recipe cards.
class RecipeGridPage extends StatefulWidget {
const RecipeGridPage({ Key? key, this.recipes }) : super(key: key);
const RecipeGridPage({ super.key, this.recipes });
final List<Recipe?>? recipes;
......@@ -189,7 +184,7 @@ class _RecipeGridPageState extends State<RecipeGridPage> {
}
class PestoLogo extends StatefulWidget {
const PestoLogo({Key? key, this.height, this.t}) : super(key: key);
const PestoLogo({super.key, this.height, this.t});
final double? height;
final double? t;
......@@ -252,7 +247,7 @@ class _PestoLogoState extends State<PestoLogo> {
// A card with the recipe's image, author, and title.
class RecipeCard extends StatelessWidget {
const RecipeCard({ Key? key, this.recipe, this.onTap }) : super(key: key);
const RecipeCard({ super.key, this.recipe, this.onTap });
final Recipe? recipe;
final VoidCallback? onTap;
......@@ -314,7 +309,7 @@ class RecipeCard extends StatelessWidget {
// Displays one recipe. Includes the recipe sheet with a background image.
class RecipePage extends StatefulWidget {
const RecipePage({ Key? key, this.recipe }) : super(key: key);
const RecipePage({ super.key, this.recipe });
final Recipe? recipe;
......@@ -433,7 +428,7 @@ class _RecipePageState extends State<RecipePage> {
/// Displays the recipe's name and instructions.
class RecipeSheet extends StatelessWidget {
RecipeSheet({ Key? key, this.recipe }) : super(key: key);
RecipeSheet({ super.key, this.recipe });
final TextStyle titleStyle = const PestoStyle(fontSize: 34.0);
final TextStyle descriptionStyle = const PestoStyle(fontSize: 15.0, color: Colors.black54, height: 24.0/15.0);
......
......@@ -13,7 +13,7 @@ import 'login.dart';
import 'supplemental/cut_corners_border.dart';
class ShrineApp extends StatefulWidget {
const ShrineApp({Key? key}) : super(key: key);
const ShrineApp({super.key});
@override
State<ShrineApp> createState() => _ShrineAppState();
......
......@@ -14,10 +14,9 @@ const double _kPeakVelocityProgress = 0.379146;
class _TappableWhileStatusIs extends StatefulWidget {
const _TappableWhileStatusIs(
this.status, {
Key? key,
this.controller,
this.child,
}) : super(key: key);
});
final AnimationController? controller;
final AnimationStatus status;
......@@ -72,10 +71,9 @@ class _TappableWhileStatusIsState extends State<_TappableWhileStatusIs> {
class _FrontLayer extends StatelessWidget {
const _FrontLayer({
Key? key,
this.onTap,
this.child,
}) : super(key: key);
});
final VoidCallback? onTap;
final Widget? child;
......@@ -109,12 +107,11 @@ class _FrontLayer extends StatelessWidget {
class _BackdropTitle extends AnimatedWidget {
const _BackdropTitle({
Key? key,
required Animation<double> listenable,
required Animation<double> super.listenable,
this.onPress,
required this.frontTitle,
required this.backTitle,
}) : super(key: key, listenable: listenable);
});
final void Function()? onPress;
final Widget frontTitle;
......@@ -198,13 +195,13 @@ class _BackdropTitle extends AnimatedWidget {
/// front or back layer is showing.
class Backdrop extends StatefulWidget {
const Backdrop({
Key? key,
super.key,
required this.frontLayer,
required this.backLayer,
required this.frontTitle,
required this.backTitle,
required this.controller,
}) : super(key: key);
});
final Widget frontLayer;
final Widget backLayer;
......
......@@ -11,9 +11,9 @@ import 'model/product.dart';
class CategoryMenuPage extends StatelessWidget {
const CategoryMenuPage({
Key? key,
super.key,
this.onCategoryTap,
}) : super(key: key);
});
final VoidCallback? onCategoryTap;
......
......@@ -25,8 +25,7 @@ const double _kCornerRadius = 24.0;
const double _kWidthForCartIcon = 64.0;
class ExpandingBottomSheet extends StatefulWidget {
const ExpandingBottomSheet({Key? key, required this.hideController})
: super(key: key);
const ExpandingBottomSheet({super.key, required this.hideController});
final AnimationController hideController;
......@@ -403,7 +402,7 @@ class ExpandingBottomSheetState extends State<ExpandingBottomSheet> with TickerP
}
class ProductThumbnailRow extends StatefulWidget {
const ProductThumbnailRow({Key? key}) : super(key: key);
const ProductThumbnailRow({super.key});
@override
State<ProductThumbnailRow> createState() => _ProductThumbnailRowState();
......@@ -512,7 +511,7 @@ class _ProductThumbnailRowState extends State<ProductThumbnailRow> {
}
class ExtraProductsNumber extends StatelessWidget {
const ExtraProductsNumber({Key? key}) : super(key: key);
const ExtraProductsNumber({super.key});
// Calculates the number to be displayed at the end of the row if there are
// more than three products in the cart. This calculates overflow products,
......@@ -555,7 +554,7 @@ class ExtraProductsNumber extends StatelessWidget {
}
class ProductThumbnail extends StatelessWidget {
const ProductThumbnail(this.animation, this.opacityAnimation, this.product, {Key? key}) : super(key: key);
const ProductThumbnail(this.animation, this.opacityAnimation, this.product, {super.key});
final Animation<double> animation;
final Animation<double> opacityAnimation;
......
......@@ -12,7 +12,7 @@ import 'model/product.dart';
import 'supplemental/asymmetric_view.dart';
class ProductPage extends StatelessWidget {
const ProductPage({Key? key, this.category = Category.all}) : super(key: key);
const ProductPage({super.key, this.category = Category.all});
final Category category;
......@@ -29,8 +29,8 @@ class HomePage extends StatelessWidget {
const HomePage({
this.expandingBottomSheet,
this.backdrop,
Key? key,
}) : super(key: key);
super.key,
});
final ExpandingBottomSheet? expandingBottomSheet;
final Backdrop? backdrop;
......
......@@ -7,7 +7,7 @@ import 'package:flutter/material.dart';
import 'colors.dart';
class LoginPage extends StatefulWidget {
const LoginPage({Key? key}) : super(key: key);
const LoginPage({super.key});
@override
State<LoginPage> createState() => _LoginPageState();
......@@ -123,7 +123,7 @@ class _LoginPageState extends State<LoginPage> {
}
class PrimaryColorOverride extends StatelessWidget {
const PrimaryColorOverride({Key? key, this.color, this.child}) : super(key: key);
const PrimaryColorOverride({super.key, this.color, this.child});
final Color? color;
final Widget? child;
......
......@@ -14,7 +14,7 @@ import 'model/product.dart';
const double _leftColumnWidth = 60.0;
class ShoppingCartPage extends StatefulWidget {
const ShoppingCartPage({Key? key}) : super(key: key);
const ShoppingCartPage({super.key});
@override
State<ShoppingCartPage> createState() => _ShoppingCartPageState();
......@@ -103,7 +103,7 @@ class _ShoppingCartPageState extends State<ShoppingCartPage> {
}
class ShoppingCartSummary extends StatelessWidget {
const ShoppingCartSummary({Key? key, this.model}) : super(key: key);
const ShoppingCartSummary({super.key, this.model});
final AppStateModel? model;
......@@ -182,11 +182,11 @@ class ShoppingCartSummary extends StatelessWidget {
class ShoppingCartRow extends StatelessWidget {
const ShoppingCartRow({
Key? key,
super.key,
required this.product,
required this.quantity,
this.onPressed,
}) : super(key: key);
});
final Product product;
final int? quantity;
......
......@@ -8,7 +8,7 @@ import '../model/product.dart';
import 'product_columns.dart';
class AsymmetricView extends StatelessWidget {
const AsymmetricView({Key? key, this.products}) : super(key: key);
const AsymmetricView({super.key, this.products});
final List<Product>? products;
......
......@@ -8,15 +8,11 @@ import 'package:flutter/material.dart';
class CutCornersBorder extends OutlineInputBorder {
const CutCornersBorder({
BorderSide borderSide = BorderSide.none,
BorderRadius borderRadius = const BorderRadius.all(Radius.circular(2.0)),
super.borderSide = BorderSide.none,
super.borderRadius = const BorderRadius.all(Radius.circular(2.0)),
this.cut = 7.0,
double gapPadding = 2.0,
}) : super(
borderSide: borderSide,
borderRadius: borderRadius,
gapPadding: gapPadding,
);
super.gapPadding = 2.0,
});
@override
CutCornersBorder copyWith({
......
......@@ -10,8 +10,8 @@ import '../model/app_state_model.dart';
import '../model/product.dart';
class ProductCard extends StatelessWidget {
const ProductCard({ Key? key, this.imageAspectRatio = 33 / 49, this.product })
: assert(imageAspectRatio > 0), super(key: key);
const ProductCard({ super.key, this.imageAspectRatio = 33 / 49, this.product })
: assert(imageAspectRatio > 0);
final double imageAspectRatio;
final Product? product;
......
......@@ -9,10 +9,10 @@ import 'product_card.dart';
class TwoProductCardColumn extends StatelessWidget {
const TwoProductCardColumn({
Key? key,
super.key,
required this.bottom,
this.top,
}) : super(key: key);
});
final Product? bottom, top;
......@@ -58,7 +58,7 @@ class TwoProductCardColumn extends StatelessWidget {
}
class OneProductCardColumn extends StatelessWidget {
const OneProductCardColumn({Key? key, this.product}) : super(key: key);
const OneProductCardColumn({super.key, this.product});
final Product? product;
......
......@@ -6,7 +6,7 @@ import 'package:flutter/material.dart';
import 'shrine/app.dart';
class ShrineDemo extends StatelessWidget {
const ShrineDemo({ Key? key }) : super(key: key);
const ShrineDemo({ super.key });
static const String routeName = '/shrine'; // Used by the Gallery app.
......
......@@ -9,7 +9,7 @@ import 'transformations_demo_edit_board_point.dart';
import 'transformations_demo_gesture_transformable.dart';
class TransformationsDemo extends StatefulWidget {
const TransformationsDemo({ Key? key }) : super(key: key);
const TransformationsDemo({ super.key });
static const String routeName = '/transformations';
......
......@@ -8,11 +8,11 @@ import 'package:flutter/material.dart';
@immutable
class ColorPicker extends StatelessWidget {
const ColorPicker({
Key? key,
super.key,
required this.colors,
required this.selectedColor,
this.onColorSelection,
}) : super(key: key);
});
final Set<Color> colors;
final Color selectedColor;
......
......@@ -10,10 +10,10 @@ import 'transformations_demo_color_picker.dart';
@immutable
class EditBoardPoint extends StatelessWidget {
const EditBoardPoint({
Key? key,
super.key,
required this.boardPoint,
this.onColorSelection,
}) : super(key: key);
});
final BoardPoint boardPoint;
final ValueChanged<Color>? onColorSelection;
......
......@@ -14,7 +14,7 @@ import 'transformations_demo_inertial_motion.dart';
@immutable
class GestureTransformable extends StatefulWidget {
const GestureTransformable({
Key? key,
super.key,
// The child to perform the transformations on.
required this.child,
// The desired visible size of the widget and the area that is receptive to
......@@ -75,8 +75,7 @@ class GestureTransformable extends StatefulWidget {
assert(
!reset || onResetEnd != null,
'Must implement onResetEnd to use reset.',
),
super(key: key);
);
final Widget child;
final Size size;
......
......@@ -6,11 +6,11 @@ import 'package:flutter/material.dart';
class TextStyleItem extends StatelessWidget {
const TextStyleItem({
Key? key,
super.key,
required this.name,
required this.style,
required this.text,
}) : super(key: key);
});
final String name;
final TextStyle style;
......@@ -39,7 +39,7 @@ class TextStyleItem extends StatelessWidget {
}
class TypographyDemo extends StatelessWidget {
const TypographyDemo({Key? key}) : super(key: key);
const TypographyDemo({super.key});
static const String routeName = '/typography';
......
......@@ -12,7 +12,7 @@ import 'package:flutter/material.dart';
import 'package:video_player/video_player.dart';
class VideoCard extends StatelessWidget {
const VideoCard({ Key? key, this.controller, this.title, this.subtitle }) : super(key: key);
const VideoCard({ super.key, this.controller, this.title, this.subtitle });
final VideoPlayerController? controller;
final String? title;
......@@ -93,7 +93,7 @@ class VideoCard extends StatelessWidget {
}
class VideoPlayerLoading extends StatefulWidget {
const VideoPlayerLoading(this.controller, {Key? key}) : super(key: key);
const VideoPlayerLoading(this.controller, {super.key});
final VideoPlayerController? controller;
......@@ -137,7 +137,7 @@ class _VideoPlayerLoadingState extends State<VideoPlayerLoading> {
}
class VideoPlayPause extends StatefulWidget {
const VideoPlayPause(this.controller, {Key? key}) : super(key: key);
const VideoPlayPause(this.controller, {super.key});
final VideoPlayerController? controller;
......@@ -203,10 +203,10 @@ class _VideoPlayPauseState extends State<VideoPlayPause> {
class FadeAnimation extends StatefulWidget {
const FadeAnimation({
Key? key,
super.key,
this.child,
this.duration = const Duration(milliseconds: 500),
}) : super(key: key);
});
final Widget? child;
final Duration duration;
......@@ -266,10 +266,10 @@ class _FadeAnimationState extends State<FadeAnimation> with SingleTickerProvider
class ConnectivityOverlay extends StatefulWidget {
const ConnectivityOverlay({
Key? key,
super.key,
this.child,
this.connectedCompleter,
}) : super(key: key);
});
final Widget? child;
final Completer<void>? connectedCompleter;
......@@ -343,7 +343,7 @@ class _ConnectivityOverlayState extends State<ConnectivityOverlay> {
}
class VideoDemo extends StatefulWidget {
const VideoDemo({ Key? key }) : super(key: key);
const VideoDemo({ super.key });
static const String routeName = '/video';
......
......@@ -22,8 +22,7 @@ class _LinkTextSpan extends TextSpan {
// manage the recognizer from outside the TextSpan, e.g. in the State of a
// stateful widget that then hands the recognizer to the TextSpan.
_LinkTextSpan({ TextStyle? style, String? url, String? text }) : super(
style: style,
_LinkTextSpan({ super.style, String? url, String? text }) : super(
text: text ?? url,
recognizer: TapGestureRecognizer()..onTap = () {
launch(url!, forceSafariVC: false);
......
......@@ -21,14 +21,14 @@ import 'updater.dart';
class GalleryApp extends StatefulWidget {
const GalleryApp({
Key? key,
super.key,
this.updateUrlFetcher,
this.enablePerformanceOverlay = true,
this.enableRasterCacheImagesCheckerboard = true,
this.enableOffscreenLayersCheckerboard = true,
this.onSendFeedback,
this.testMode = false,
}) : super(key: key);
});
final UpdateUrlFetcher? updateUrlFetcher;
final bool enablePerformanceOverlay;
......
......@@ -25,10 +25,9 @@ final Animatable<BorderRadius?> _kFrontHeadingBevelRadius = BorderRadiusTween(
class _TappableWhileStatusIs extends StatefulWidget {
const _TappableWhileStatusIs(
this.status, {
Key? key,
this.controller,
this.child,
}) : super(key: key);
});
final AnimationController? controller;
final AnimationStatus status;
......@@ -83,12 +82,11 @@ class _TappableWhileStatusIsState extends State<_TappableWhileStatusIs> {
class _CrossFadeTransition extends AnimatedWidget {
const _CrossFadeTransition({
Key? key,
this.alignment = Alignment.center,
required Animation<double> progress,
this.child0,
this.child1,
}) : super(key: key, listenable: progress);
}) : super(listenable: progress);
final AlignmentGeometry alignment;
final Widget? child0;
......@@ -134,11 +132,10 @@ class _CrossFadeTransition extends AnimatedWidget {
class _BackAppBar extends StatelessWidget {
const _BackAppBar({
Key? key,
this.leading = const SizedBox(width: 56.0),
required this.title,
this.trailing,
}) : super(key: key);
});
final Widget leading;
final Widget title;
......@@ -179,14 +176,14 @@ class _BackAppBar extends StatelessWidget {
class Backdrop extends StatefulWidget {
const Backdrop({
Key? key,
super.key,
this.frontAction,
this.frontTitle,
this.frontHeading,
this.frontLayer,
this.backTitle,
this.backLayer,
}) : super(key: key);
});
final Widget? frontAction;
final Widget? frontTitle;
......
......@@ -42,13 +42,13 @@ class ComponentDemoTabData {
class TabbedComponentDemoScaffold extends StatelessWidget {
const TabbedComponentDemoScaffold({
Key? key,
super.key,
this.title,
this.demos,
this.actions,
this.isScrollable = true,
this.showExampleCodeAction = true,
}) : super(key: key);
});
final List<ComponentDemoTabData>? demos;
final String? title;
......@@ -148,7 +148,7 @@ class TabbedComponentDemoScaffold extends StatelessWidget {
}
class FullScreenCodeDialog extends StatefulWidget {
const FullScreenCodeDialog({ Key? key, this.exampleCodeTag }) : super(key: key);
const FullScreenCodeDialog({ super.key, this.exampleCodeTag });
final String? exampleCodeTag;
......@@ -216,13 +216,12 @@ class FullScreenCodeDialogState extends State<FullScreenCodeDialog> {
}
class MaterialDemoDocumentationButton extends StatelessWidget {
MaterialDemoDocumentationButton(String routeName, { Key? key })
MaterialDemoDocumentationButton(String routeName, { super.key })
: documentationUrl = kDemoDocumentationUrl[routeName],
assert(
kDemoDocumentationUrl[routeName] != null,
'A documentation URL was not specified for demo route $routeName in kAllGalleryDemos',
),
super(key: key);
);
final String? documentationUrl;
......@@ -237,13 +236,12 @@ class MaterialDemoDocumentationButton extends StatelessWidget {
}
class CupertinoDemoDocumentationButton extends StatelessWidget {
CupertinoDemoDocumentationButton(String routeName, { Key? key })
CupertinoDemoDocumentationButton(String routeName, { super.key })
: documentationUrl = kDemoDocumentationUrl[routeName],
assert(
kDemoDocumentationUrl[routeName] != null,
'A documentation URL was not specified for demo route $routeName in kAllGalleryDemos',
),
super(key: key);
);
final String? documentationUrl;
......
......@@ -18,7 +18,7 @@ const double _kDemoItemHeight = 64.0;
const Duration _kFrontLayerSwitchDuration = Duration(milliseconds: 300);
class _FlutterLogo extends StatelessWidget {
const _FlutterLogo({ Key? key }) : super(key: key);
const _FlutterLogo();
@override
Widget build(BuildContext context) {
......@@ -41,10 +41,9 @@ class _FlutterLogo extends StatelessWidget {
class _CategoryItem extends StatelessWidget {
const _CategoryItem({
Key? key,
this.category,
this.onTap,
}) : super (key: key);
});
final GalleryDemoCategory? category;
final VoidCallback? onTap;
......@@ -95,10 +94,9 @@ class _CategoryItem extends StatelessWidget {
class _CategoriesPage extends StatelessWidget {
const _CategoriesPage({
Key? key,
this.categories,
this.onCategoryTap,
}) : super(key: key);
});
final Iterable<GalleryDemoCategory>? categories;
final ValueChanged<GalleryDemoCategory>? onCategoryTap;
......@@ -162,7 +160,7 @@ class _CategoriesPage extends StatelessWidget {
}
class _DemoItem extends StatelessWidget {
const _DemoItem({ Key? key, this.demo }) : super(key: key);
const _DemoItem({ this.demo });
final GalleryDemo? demo;
......@@ -262,10 +260,10 @@ class _DemosPage extends StatelessWidget {
class GalleryHome extends StatefulWidget {
const GalleryHome({
Key? key,
super.key,
this.testMode = false,
this.optionsPage,
}) : super(key: key);
});
final Widget? optionsPage;
final bool testMode;
......
......@@ -93,7 +93,7 @@ const double _kItemHeight = 48.0;
const EdgeInsetsDirectional _kItemPadding = EdgeInsetsDirectional.only(start: 56.0);
class _OptionsItem extends StatelessWidget {
const _OptionsItem({ Key? key, this.child }) : super(key: key);
const _OptionsItem({ this.child });
final Widget? child;
......@@ -167,7 +167,7 @@ class _ActionItem extends StatelessWidget {
}
class _TextButton extends StatelessWidget {
const _TextButton({ Key? key, this.onPressed, this.child }) : super(key: key);
const _TextButton({ this.onPressed, this.child });
final VoidCallback? onPressed;
final Widget? child;
......@@ -467,11 +467,11 @@ class _PlatformItem extends StatelessWidget {
class GalleryOptionsPage extends StatelessWidget {
const GalleryOptionsPage({
Key? key,
super.key,
this.options,
this.onOptionsChanged,
this.onSendFeedback,
}) : super(key: key);
});
final GalleryOptions? options;
final ValueChanged<GalleryOptions>? onOptionsChanged;
......
......@@ -9,8 +9,7 @@ import 'package:url_launcher/url_launcher.dart';
typedef UpdateUrlFetcher = Future<String?> Function();
class Updater extends StatefulWidget {
const Updater({ required this.updateUrlFetcher, this.child, Key? key })
: super(key: key);
const Updater({ required this.updateUrlFetcher, this.child, super.key });
final UpdateUrlFetcher updateUrlFetcher;
final Widget? child;
......
name: flutter_gallery
environment:
sdk: ">=2.12.0-0 <3.0.0"
sdk: ">=2.17.0-0 <3.0.0"
dependencies:
flutter:
......
......@@ -101,7 +101,7 @@ final Finder backFinder = find.byElementPredicate(
);
class _LiveWidgetController extends LiveWidgetController {
_LiveWidgetController(WidgetsBinding binding) : super(binding);
_LiveWidgetController(super.binding);
/// With [frameSync] enabled, Flutter Driver will wait to perform an action
/// until there are no pending frames in the app under test.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment