Unverified Commit 0f568298 authored by Michael Goderbauer's avatar Michael Goderbauer Committed by GitHub

enable use_key_in_widget_constructors lint (#77032)

parent 6ec90142
...@@ -168,8 +168,8 @@ linter: ...@@ -168,8 +168,8 @@ linter:
- prefer_if_null_operators - prefer_if_null_operators
- prefer_initializing_formals - prefer_initializing_formals
- prefer_inlined_adds - prefer_inlined_adds
# - prefer_int_literals # not yet tested # - prefer_int_literals # conflicts with https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#use-double-literals-for-double-constants
# - prefer_interpolation_to_compose_strings # not yet tested # - prefer_interpolation_to_compose_strings # doesn't work with raw strings, see https://github.com/dart-lang/linter/issues/2490
- prefer_is_empty - prefer_is_empty
- prefer_is_not_empty - prefer_is_not_empty
- prefer_is_not_operator - prefer_is_not_operator
...@@ -220,7 +220,7 @@ linter: ...@@ -220,7 +220,7 @@ linter:
# - use_function_type_syntax_for_parameters # not yet tested # - use_function_type_syntax_for_parameters # not yet tested
# - use_if_null_to_convert_nulls_to_bools # not yet tested # - use_if_null_to_convert_nulls_to_bools # not yet tested
- use_is_even_rather_than_modulo - use_is_even_rather_than_modulo
# - use_key_in_widget_constructors # not yet tested - use_key_in_widget_constructors
- use_late_for_private_fields_and_variables - use_late_for_private_fields_and_variables
# - use_named_constants # not yet yested # - use_named_constants # not yet yested
- use_raw_strings - use_raw_strings
......
...@@ -7,13 +7,15 @@ import 'package:flutter/scheduler.dart' show timeDilation; ...@@ -7,13 +7,15 @@ import 'package:flutter/scheduler.dart' show timeDilation;
void main() { void main() {
runApp( runApp(
ComplexLayoutApp() const ComplexLayoutApp()
); );
} }
enum ScrollMode { complex, tile } enum ScrollMode { complex, tile }
class ComplexLayoutApp extends StatefulWidget { class ComplexLayoutApp extends StatefulWidget {
const ComplexLayoutApp({Key key}) : super(key: key);
@override @override
ComplexLayoutAppState createState() => ComplexLayoutAppState(); ComplexLayoutAppState createState() => ComplexLayoutAppState();
...@@ -68,7 +70,7 @@ class TileScrollLayout extends StatelessWidget { ...@@ -68,7 +70,7 @@ class TileScrollLayout extends StatelessWidget {
child: Material( child: Material(
elevation: (index % 5 + 1).toDouble(), elevation: (index % 5 + 1).toDouble(),
color: Colors.white, color: Colors.white,
child: IconBar(), child: const IconBar(),
), ),
); );
}, },
...@@ -101,7 +103,7 @@ class ComplexLayoutState extends State<ComplexLayout> { ...@@ -101,7 +103,7 @@ class ComplexLayoutState extends State<ComplexLayout> {
print('Pressed search'); print('Pressed search');
}, },
), ),
TopBarMenu(), const TopBarMenu(),
], ],
), ),
body: Column( body: Column(
...@@ -118,7 +120,7 @@ class ComplexLayoutState extends State<ComplexLayout> { ...@@ -118,7 +120,7 @@ class ComplexLayoutState extends State<ComplexLayout> {
}, },
), ),
), ),
BottomBar(), const BottomBar(),
], ],
), ),
drawer: const GalleryDrawer(), drawer: const GalleryDrawer(),
...@@ -127,6 +129,8 @@ class ComplexLayoutState extends State<ComplexLayout> { ...@@ -127,6 +129,8 @@ class ComplexLayoutState extends State<ComplexLayout> {
} }
class TopBarMenu extends StatelessWidget { class TopBarMenu extends StatelessWidget {
const TopBarMenu({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return PopupMenuButton<String>( return PopupMenuButton<String>(
...@@ -178,7 +182,7 @@ class TopBarMenu extends StatelessWidget { ...@@ -178,7 +182,7 @@ class TopBarMenu extends StatelessWidget {
} }
class MenuItemWithIcon extends StatelessWidget { class MenuItemWithIcon extends StatelessWidget {
const MenuItemWithIcon(this.icon, this.title, this.subtitle); const MenuItemWithIcon(this.icon, this.title, this.subtitle, {Key key}) : super(key: key);
final IconData icon; final IconData icon;
final String title; final String title;
...@@ -209,15 +213,15 @@ class FancyImageItem extends StatelessWidget { ...@@ -209,15 +213,15 @@ class FancyImageItem extends StatelessWidget {
return ListBody( return ListBody(
children: <Widget>[ children: <Widget>[
UserHeader('Ali Connors $index'), UserHeader('Ali Connors $index'),
ItemDescription(), const ItemDescription(),
ItemImageBox(), const ItemImageBox(),
InfoBar(), const InfoBar(),
const Padding( const Padding(
padding: EdgeInsets.symmetric(horizontal: 8.0), padding: EdgeInsets.symmetric(horizontal: 8.0),
child: Divider(), child: Divider(),
), ),
IconBar(), const IconBar(),
FatDivider(), const FatDivider(),
], ],
); );
} }
...@@ -233,19 +237,21 @@ class FancyGalleryItem extends StatelessWidget { ...@@ -233,19 +237,21 @@ class FancyGalleryItem extends StatelessWidget {
children: <Widget>[ children: <Widget>[
const UserHeader('Ali Connors'), const UserHeader('Ali Connors'),
ItemGalleryBox(index), ItemGalleryBox(index),
InfoBar(), const InfoBar(),
const Padding( const Padding(
padding: EdgeInsets.symmetric(horizontal: 8.0), padding: EdgeInsets.symmetric(horizontal: 8.0),
child: Divider(), child: Divider(),
), ),
IconBar(), const IconBar(),
FatDivider(), const FatDivider(),
], ],
); );
} }
} }
class InfoBar extends StatelessWidget { class InfoBar extends StatelessWidget {
const InfoBar({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Padding( return Padding(
...@@ -262,6 +268,8 @@ class InfoBar extends StatelessWidget { ...@@ -262,6 +268,8 @@ class InfoBar extends StatelessWidget {
} }
class IconBar extends StatelessWidget { class IconBar extends StatelessWidget {
const IconBar({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Padding( return Padding(
...@@ -279,7 +287,7 @@ class IconBar extends StatelessWidget { ...@@ -279,7 +287,7 @@ class IconBar extends StatelessWidget {
} }
class IconWithText extends StatelessWidget { class IconWithText extends StatelessWidget {
const IconWithText(this.icon, this.title); const IconWithText(this.icon, this.title, {Key key}) : super(key: key);
final IconData icon; final IconData icon;
final String title; final String title;
...@@ -300,7 +308,7 @@ class IconWithText extends StatelessWidget { ...@@ -300,7 +308,7 @@ class IconWithText extends StatelessWidget {
} }
class MiniIconWithText extends StatelessWidget { class MiniIconWithText extends StatelessWidget {
const MiniIconWithText(this.icon, this.title); const MiniIconWithText(this.icon, this.title, {Key key}) : super(key: key);
final IconData icon; final IconData icon;
final String title; final String title;
...@@ -329,6 +337,8 @@ class MiniIconWithText extends StatelessWidget { ...@@ -329,6 +337,8 @@ class MiniIconWithText extends StatelessWidget {
} }
class FatDivider extends StatelessWidget { class FatDivider extends StatelessWidget {
const FatDivider({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
...@@ -339,7 +349,7 @@ class FatDivider extends StatelessWidget { ...@@ -339,7 +349,7 @@ class FatDivider extends StatelessWidget {
} }
class UserHeader extends StatelessWidget { class UserHeader extends StatelessWidget {
const UserHeader(this.userName); const UserHeader(this.userName, {Key key}) : super(key: key);
final String userName; final String userName;
...@@ -380,7 +390,7 @@ class UserHeader extends StatelessWidget { ...@@ -380,7 +390,7 @@ class UserHeader extends StatelessWidget {
], ],
), ),
), ),
TopBarMenu(), const TopBarMenu(),
], ],
), ),
); );
...@@ -388,6 +398,8 @@ class UserHeader extends StatelessWidget { ...@@ -388,6 +398,8 @@ class UserHeader extends StatelessWidget {
} }
class ItemDescription extends StatelessWidget { class ItemDescription extends StatelessWidget {
const ItemDescription({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return const Padding( return const Padding(
...@@ -398,6 +410,8 @@ class ItemDescription extends StatelessWidget { ...@@ -398,6 +410,8 @@ class ItemDescription extends StatelessWidget {
} }
class ItemImageBox extends StatelessWidget { class ItemImageBox extends StatelessWidget {
const ItemImageBox({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Padding( return Padding(
...@@ -477,7 +491,7 @@ class ItemImageBox extends StatelessWidget { ...@@ -477,7 +491,7 @@ class ItemImageBox extends StatelessWidget {
} }
class ItemGalleryBox extends StatelessWidget { class ItemGalleryBox extends StatelessWidget {
const ItemGalleryBox(this.index); const ItemGalleryBox(this.index, {Key key}) : super(key: key);
final int index; final int index;
...@@ -548,6 +562,8 @@ class ItemGalleryBox extends StatelessWidget { ...@@ -548,6 +562,8 @@ class ItemGalleryBox extends StatelessWidget {
} }
class BottomBar extends StatelessWidget { class BottomBar extends StatelessWidget {
const BottomBar({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
...@@ -574,7 +590,7 @@ class BottomBar extends StatelessWidget { ...@@ -574,7 +590,7 @@ class BottomBar extends StatelessWidget {
} }
class BottomBarButton extends StatelessWidget { class BottomBarButton extends StatelessWidget {
const BottomBarButton(this.icon, this.title); const BottomBarButton(this.icon, this.title, {Key key}) : super(key: key);
final IconData icon; final IconData icon;
final String title; final String title;
...@@ -618,7 +634,7 @@ class GalleryDrawer extends StatelessWidget { ...@@ -618,7 +634,7 @@ class GalleryDrawer extends StatelessWidget {
key: const PageStorageKey<String>('gallery-drawer'), key: const PageStorageKey<String>('gallery-drawer'),
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
children: <Widget>[ children: <Widget>[
FancyDrawerHeader(), const FancyDrawerHeader(),
ListTile( ListTile(
key: const Key('scroll-switcher'), key: const Key('scroll-switcher'),
title: const Text('Scroll Mode'), title: const Text('Scroll Mode'),
...@@ -668,6 +684,8 @@ class GalleryDrawer extends StatelessWidget { ...@@ -668,6 +684,8 @@ class GalleryDrawer extends StatelessWidget {
} }
class FancyDrawerHeader extends StatelessWidget { class FancyDrawerHeader extends StatelessWidget {
const FancyDrawerHeader({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
......
...@@ -27,7 +27,7 @@ Future<void> main() async { ...@@ -27,7 +27,7 @@ Future<void> main() async {
ready.complete(); ready.complete();
}, },
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
child: IgnorePointer( child: const IgnorePointer(
ignoring: true, ignoring: true,
child: ComplexLayoutApp(), child: ComplexLayoutApp(),
), ),
...@@ -45,7 +45,7 @@ Future<void> main() async { ...@@ -45,7 +45,7 @@ Future<void> main() async {
// remove onTap handler, enable pointer events for app // remove onTap handler, enable pointer events for app
runApp(GestureDetector( runApp(GestureDetector(
child: IgnorePointer( child: const IgnorePointer(
ignoring: false, ignoring: false,
child: ComplexLayoutApp(), child: ComplexLayoutApp(),
), ),
......
...@@ -29,7 +29,7 @@ const String kMacrobenchmarks = 'Macrobenchmarks'; ...@@ -29,7 +29,7 @@ const String kMacrobenchmarks = 'Macrobenchmarks';
void main() => runApp(const MacrobenchmarksApp()); void main() => runApp(const MacrobenchmarksApp());
class MacrobenchmarksApp extends StatelessWidget { class MacrobenchmarksApp extends StatelessWidget {
const MacrobenchmarksApp({this.initialRoute = '/'}); const MacrobenchmarksApp({Key key, this.initialRoute = '/'}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
...@@ -37,25 +37,25 @@ class MacrobenchmarksApp extends StatelessWidget { ...@@ -37,25 +37,25 @@ class MacrobenchmarksApp extends StatelessWidget {
title: kMacrobenchmarks, title: kMacrobenchmarks,
initialRoute: initialRoute, initialRoute: initialRoute,
routes: <String, WidgetBuilder>{ routes: <String, WidgetBuilder>{
'/': (BuildContext context) => HomePage(), '/': (BuildContext context) => const HomePage(),
kCullOpacityRouteName: (BuildContext context) => CullOpacityPage(), kCullOpacityRouteName: (BuildContext context) => const CullOpacityPage(),
kCubicBezierRouteName: (BuildContext context) => CubicBezierPage(), kCubicBezierRouteName: (BuildContext context) => const CubicBezierPage(),
kBackdropFilterRouteName: (BuildContext context) => BackdropFilterPage(), kBackdropFilterRouteName: (BuildContext context) => const BackdropFilterPage(),
kPostBackdropFilterRouteName: (BuildContext context) => PostBackdropFilterPage(), kPostBackdropFilterRouteName: (BuildContext context) => const PostBackdropFilterPage(),
kSimpleAnimationRouteName: (BuildContext context) => SimpleAnimationPage(), kSimpleAnimationRouteName: (BuildContext context) => const SimpleAnimationPage(),
kPictureCacheRouteName: (BuildContext context) => PictureCachePage(), kPictureCacheRouteName: (BuildContext context) => const PictureCachePage(),
kLargeImageChangerRouteName: (BuildContext context) => LargeImageChangerPage(), kLargeImageChangerRouteName: (BuildContext context) => const LargeImageChangerPage(),
kLargeImagesRouteName: (BuildContext context) => LargeImagesPage(), kLargeImagesRouteName: (BuildContext context) => const LargeImagesPage(),
kTextRouteName: (BuildContext context) => TextPage(), kTextRouteName: (BuildContext context) => const TextPage(),
kFullscreenTextRouteName: (BuildContext context) => TextFieldPage(), kFullscreenTextRouteName: (BuildContext context) => const TextFieldPage(),
kAnimatedPlaceholderRouteName: (BuildContext context) => AnimatedPlaceholderPage(), kAnimatedPlaceholderRouteName: (BuildContext context) => const AnimatedPlaceholderPage(),
kColorFilterAndFadeRouteName: (BuildContext context) => ColorFilterAndFadePage(), kColorFilterAndFadeRouteName: (BuildContext context) => const ColorFilterAndFadePage(),
kFadingChildAnimationRouteName: (BuildContext context) => const FilteredChildAnimationPage(FilterType.opacity), kFadingChildAnimationRouteName: (BuildContext context) => const FilteredChildAnimationPage(FilterType.opacity),
kImageFilteredTransformAnimationRouteName: (BuildContext context) => const FilteredChildAnimationPage(FilterType.rotateFilter), kImageFilteredTransformAnimationRouteName: (BuildContext context) => const FilteredChildAnimationPage(FilterType.rotateFilter),
kMultiWidgetConstructionRouteName: (BuildContext context) => const MultiWidgetConstructTable(10, 20), kMultiWidgetConstructionRouteName: (BuildContext context) => const MultiWidgetConstructTable(10, 20),
kHeavyGridViewRouteName: (BuildContext context) => HeavyGridViewPage(), kHeavyGridViewRouteName: (BuildContext context) => const HeavyGridViewPage(),
kSimpleScrollRouteName: (BuildContext context) => SimpleScroll(), kSimpleScrollRouteName: (BuildContext context) => const SimpleScroll(),
kStackSizeRouteName: (BuildContext context) => StackSizePage(), kStackSizeRouteName: (BuildContext context) => const StackSizePage(),
}, },
); );
} }
...@@ -64,6 +64,8 @@ class MacrobenchmarksApp extends StatelessWidget { ...@@ -64,6 +64,8 @@ class MacrobenchmarksApp extends StatelessWidget {
} }
class HomePage extends StatelessWidget { class HomePage extends StatelessWidget {
const HomePage({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
......
...@@ -24,6 +24,8 @@ const String kBlueSquare = 'iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAASEl' ...@@ -24,6 +24,8 @@ const String kBlueSquare = 'iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAASEl'
/// A 10x10 grid of animated looping placeholder gifts that fade into a /// A 10x10 grid of animated looping placeholder gifts that fade into a
/// blue square. /// blue square.
class AnimatedPlaceholderPage extends StatelessWidget { class AnimatedPlaceholderPage extends StatelessWidget {
const AnimatedPlaceholderPage({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return GridView.builder( return GridView.builder(
......
...@@ -7,6 +7,8 @@ import 'dart:ui'; ...@@ -7,6 +7,8 @@ import 'dart:ui';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class BackdropFilterPage extends StatefulWidget { class BackdropFilterPage extends StatefulWidget {
const BackdropFilterPage({Key key}) : super(key: key);
@override @override
_BackdropFilterPageState createState() => _BackdropFilterPageState(); _BackdropFilterPageState createState() => _BackdropFilterPageState();
} }
......
...@@ -9,6 +9,8 @@ import 'package:flutter/material.dart'; ...@@ -9,6 +9,8 @@ import 'package:flutter/material.dart';
// This tests whether the Opacity layer raster cache works with color filters. // This tests whether the Opacity layer raster cache works with color filters.
// See https://github.com/flutter/flutter/issues/51975. // See https://github.com/flutter/flutter/issues/51975.
class ColorFilterAndFadePage extends StatefulWidget { class ColorFilterAndFadePage extends StatefulWidget {
const ColorFilterAndFadePage({Key key}) : super(key: key);
@override @override
_ColorFilterAndFadePageState createState() => _ColorFilterAndFadePageState(); _ColorFilterAndFadePageState createState() => _ColorFilterAndFadePageState();
} }
......
...@@ -8,6 +8,8 @@ import 'package:flutter/material.dart'; ...@@ -8,6 +8,8 @@ import 'package:flutter/material.dart';
// Based on https://github.com/eseidelGoogle/bezier_perf/blob/master/lib/main.dart // Based on https://github.com/eseidelGoogle/bezier_perf/blob/master/lib/main.dart
class CubicBezierPage extends StatelessWidget { class CubicBezierPage extends StatelessWidget {
const CubicBezierPage({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Center( return Center(
...@@ -22,7 +24,7 @@ class CubicBezierPage extends StatelessWidget { ...@@ -22,7 +24,7 @@ class CubicBezierPage extends StatelessWidget {
} }
class Bezier extends StatelessWidget { class Bezier extends StatelessWidget {
const Bezier(this.color, this.scale, {this.blur = 0.0, this.delay = 0.0}); const Bezier(this.color, this.scale, {Key key, this.blur = 0.0, this.delay = 0.0}) : super(key: key);
final Color color; final Color color;
final double scale; final double scale;
...@@ -91,7 +93,7 @@ class PathDetail { ...@@ -91,7 +93,7 @@ class PathDetail {
} }
class AnimatedBezier extends StatefulWidget { class AnimatedBezier extends StatefulWidget {
const AnimatedBezier(this.color, this.scale, {this.blur = 0.0, this.delay}); const AnimatedBezier(this.color, this.scale, {Key key, this.blur = 0.0, this.delay}) : super(key: key);
final Color color; final Color color;
final double scale; final double scale;
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class CullOpacityPage extends StatefulWidget { class CullOpacityPage extends StatefulWidget {
const CullOpacityPage({Key key}) : super(key: key);
@override @override
State<StatefulWidget> createState() => _CullOpacityPageState(); State<StatefulWidget> createState() => _CullOpacityPageState();
} }
......
...@@ -12,10 +12,11 @@ enum FilterType { ...@@ -12,10 +12,11 @@ enum FilterType {
} }
class FilteredChildAnimationPage extends StatefulWidget { class FilteredChildAnimationPage extends StatefulWidget {
const FilteredChildAnimationPage(this.initialFilterType, [ const FilteredChildAnimationPage(this.initialFilterType, {
Key key,
this.initialComplexChild = true, this.initialComplexChild = true,
this.initialUseRepaintBoundary = true, this.initialUseRepaintBoundary = true,
]); }) : super(key: key);
final FilterType initialFilterType; final FilterType initialFilterType;
final bool initialComplexChild; final bool initialComplexChild;
......
...@@ -48,6 +48,8 @@ const String textLotsOfText = 'Lorem ipsum dolor sit amet, consectetur ' ...@@ -48,6 +48,8 @@ const String textLotsOfText = 'Lorem ipsum dolor sit amet, consectetur '
'🦻 👃 🫀 🫁 🧠 🦷 🦴 👀 👁 👅 👄 💋 🩸'; '🦻 👃 🫀 🫁 🧠 🦷 🦴 👀 👁 👅 👄 💋 🩸';
class TextFieldPage extends StatelessWidget { class TextFieldPage extends StatelessWidget {
const TextFieldPage({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Material( return Material(
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class HeavyGridViewPage extends StatelessWidget { class HeavyGridViewPage extends StatelessWidget {
const HeavyGridViewPage({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return GridView.builder( return GridView.builder(
......
...@@ -8,6 +8,8 @@ import 'package:flutter/material.dart'; ...@@ -8,6 +8,8 @@ import 'package:flutter/material.dart';
/// Displays a new (from image cache's perspective) large image every 500ms. /// Displays a new (from image cache's perspective) large image every 500ms.
class LargeImageChangerPage extends StatefulWidget { class LargeImageChangerPage extends StatefulWidget {
const LargeImageChangerPage({Key key}) : super(key: key);
@override @override
_LargeImageChangerState createState() => _LargeImageChangerState(); _LargeImageChangerState createState() => _LargeImageChangerState();
} }
......
...@@ -7,6 +7,8 @@ import 'dart:typed_data'; ...@@ -7,6 +7,8 @@ import 'dart:typed_data';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class LargeImagesPage extends StatelessWidget { class LargeImagesPage extends StatelessWidget {
const LargeImagesPage({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final ImageCache imageCache = PaintingBinding.instance.imageCache; final ImageCache imageCache = PaintingBinding.instance.imageCache;
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class PictureCachePage extends StatelessWidget { class PictureCachePage extends StatelessWidget {
const PictureCachePage({Key key}) : super(key: key);
static const List<String> kTabNames = <String>['1', '2', '3', '4', '5']; static const List<String> kTabNames = <String>['1', '2', '3', '4', '5'];
@override @override
......
...@@ -7,6 +7,8 @@ import 'dart:ui'; ...@@ -7,6 +7,8 @@ import 'dart:ui';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class PostBackdropFilterPage extends StatefulWidget { class PostBackdropFilterPage extends StatefulWidget {
const PostBackdropFilterPage({Key key}) : super(key: key);
@override @override
_PostBackdropFilterPageState createState() => _PostBackdropFilterPageState(); _PostBackdropFilterPageState createState() => _PostBackdropFilterPageState();
} }
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class SimpleAnimationPage extends StatelessWidget { class SimpleAnimationPage extends StatelessWidget {
const SimpleAnimationPage({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return const Center(child: LinearProgressIndicator()); return const Center(child: LinearProgressIndicator());
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class SimpleScroll extends StatelessWidget { class SimpleScroll extends StatelessWidget {
const SimpleScroll({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ListView( return ListView(
......
...@@ -81,6 +81,8 @@ final GetStackPointerCallback getStackPointer = () { ...@@ -81,6 +81,8 @@ final GetStackPointerCallback getStackPointer = () {
}(); }();
class StackSizePage extends StatelessWidget { class StackSizePage extends StatelessWidget {
const StackSizePage({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Material( return Material(
...@@ -89,7 +91,7 @@ class StackSizePage extends StatelessWidget { ...@@ -89,7 +91,7 @@ class StackSizePage extends StatelessWidget {
Container( Container(
width: 200, width: 200,
height: 100, height: 100,
child: ParentWidget(), child: const ParentWidget(),
), ),
], ],
), ),
...@@ -98,6 +100,8 @@ class StackSizePage extends StatelessWidget { ...@@ -98,6 +100,8 @@ class StackSizePage extends StatelessWidget {
} }
class ParentWidget extends StatelessWidget { class ParentWidget extends StatelessWidget {
const ParentWidget({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final int myStackSize = getStackPointer(); final int myStackSize = getStackPointer();
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class TextPage extends StatelessWidget { class TextPage extends StatelessWidget {
const TextPage({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Material( return Material(
......
...@@ -271,7 +271,7 @@ class BenchBuildColorsGrid extends WidgetBuildRecorder { ...@@ -271,7 +271,7 @@ class BenchBuildColorsGrid extends WidgetBuildRecorder {
@override @override
Widget createWidget() { Widget createWidget() {
_counter++; _counter++;
return MaterialApp(home: ColorsDemo()); return const MaterialApp(home: ColorsDemo());
} }
} }
...@@ -469,6 +469,8 @@ class PaletteTabView extends StatelessWidget { ...@@ -469,6 +469,8 @@ class PaletteTabView extends StatelessWidget {
} }
class ColorsDemo extends StatelessWidget { class ColorsDemo extends StatelessWidget {
const ColorsDemo({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return DefaultTabController( return DefaultTabController(
......
...@@ -84,7 +84,7 @@ class _MyHomePageState extends State<MyHomePage> { ...@@ -84,7 +84,7 @@ class _MyHomePageState extends State<MyHomePage> {
} }
class ProductPreview extends StatelessWidget { class ProductPreview extends StatelessWidget {
const ProductPreview(this.previewIndex); const ProductPreview(this.previewIndex, {Key key}) : super(key: key);
final int previewIndex; final int previewIndex;
......
...@@ -17,7 +17,7 @@ void main() { ...@@ -17,7 +17,7 @@ void main() {
testWidgets( testWidgets(
'Frame Counter and Input Delay for benchmarkLive', 'Frame Counter and Input Delay for benchmarkLive',
(WidgetTester tester) async { (WidgetTester tester) async {
await tester.pumpWidget(MaterialApp(home: Scaffold(body: SimpleScroll()))); await tester.pumpWidget(const MaterialApp(home: Scaffold(body: SimpleScroll())));
await tester.pumpAndSettle(); await tester.pumpAndSettle();
final Offset location = tester.getCenter(find.byType(ListView)); final Offset location = tester.getCenter(find.byType(ListView));
int frameCount = 0; int frameCount = 0;
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class ButtonMatrixApp extends StatefulWidget { class ButtonMatrixApp extends StatefulWidget {
const ButtonMatrixApp({Key key}) : super(key: key);
@override @override
ButtonMatrixAppState createState() => ButtonMatrixAppState(); ButtonMatrixAppState createState() => ButtonMatrixAppState();
} }
...@@ -48,5 +50,5 @@ class ButtonMatrixAppState extends State<ButtonMatrixApp> { ...@@ -48,5 +50,5 @@ class ButtonMatrixAppState extends State<ButtonMatrixApp> {
} }
void main() { void main() {
runApp(ButtonMatrixApp()); runApp(const ButtonMatrixApp());
} }
...@@ -13,7 +13,7 @@ void topMain() => runApp(const MyApp(Colors.green)); ...@@ -13,7 +13,7 @@ void topMain() => runApp(const MyApp(Colors.green));
void bottomMain() => runApp(const MyApp(Colors.purple)); void bottomMain() => runApp(const MyApp(Colors.purple));
class MyApp extends StatelessWidget { class MyApp extends StatelessWidget {
const MyApp(this.color); const MyApp(this.color, {Key key}) : super(key: key);
final Color color; final Color color;
......
...@@ -20,6 +20,8 @@ import 'stock_symbol_viewer.dart'; ...@@ -20,6 +20,8 @@ import 'stock_symbol_viewer.dart';
import 'stock_types.dart'; import 'stock_types.dart';
class StocksApp extends StatefulWidget { class StocksApp extends StatefulWidget {
const StocksApp({Key key}) : super(key: key);
@override @override
StocksAppState createState() => StocksAppState(); StocksAppState createState() => StocksAppState();
} }
...@@ -109,5 +111,5 @@ class StocksAppState extends State<StocksApp> { ...@@ -109,5 +111,5 @@ class StocksAppState extends State<StocksApp> {
} }
void main() { void main() {
runApp(StocksApp()); runApp(const StocksApp());
} }
...@@ -52,7 +52,7 @@ class _NotImplementedDialog extends StatelessWidget { ...@@ -52,7 +52,7 @@ class _NotImplementedDialog extends StatelessWidget {
} }
class StockHome extends StatefulWidget { class StockHome extends StatefulWidget {
const StockHome(this.stocks, this.configuration, this.updater); const StockHome(this.stocks, this.configuration, this.updater, {Key key}) : super(key: key);
final StockData stocks; final StockData stocks;
final StockConfiguration configuration; final StockConfiguration configuration;
......
...@@ -7,7 +7,7 @@ import 'package:flutter/material.dart'; ...@@ -7,7 +7,7 @@ import 'package:flutter/material.dart';
import 'stock_types.dart'; import 'stock_types.dart';
class StockSettings extends StatefulWidget { class StockSettings extends StatefulWidget {
const StockSettings(this.configuration, this.updater); const StockSettings(this.configuration, this.updater, {Key key}) : super(key: key);
final StockConfiguration configuration; final StockConfiguration configuration;
final ValueChanged<StockConfiguration> updater; final ValueChanged<StockConfiguration> updater;
......
...@@ -65,7 +65,7 @@ class _StockSymbolView extends StatelessWidget { ...@@ -65,7 +65,7 @@ class _StockSymbolView extends StatelessWidget {
} }
class StockSymbolPage extends StatelessWidget { class StockSymbolPage extends StatelessWidget {
const StockSymbolPage({ this.symbol, this.stocks }); const StockSymbolPage({ Key key, this.symbol, this.stocks }) : super(key: key);
final String symbol; final String symbol;
final StockData stocks; final StockData stocks;
...@@ -113,7 +113,7 @@ class StockSymbolPage extends StatelessWidget { ...@@ -113,7 +113,7 @@ class StockSymbolPage extends StatelessWidget {
} }
class StockSymbolBottomSheet extends StatelessWidget { class StockSymbolBottomSheet extends StatelessWidget {
const StockSymbolBottomSheet({ this.stock }); const StockSymbolBottomSheet({ Key key, this.stock }) : super(key: key);
final Stock stock; final Stock stock;
......
...@@ -9,11 +9,13 @@ Future<void> main() async { ...@@ -9,11 +9,13 @@ Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
const MethodChannel channel = MethodChannel('com.example.abstract_method_smoke_test'); const MethodChannel channel = MethodChannel('com.example.abstract_method_smoke_test');
await channel.invokeMethod<void>('show_keyboard'); await channel.invokeMethod<void>('show_keyboard');
runApp(MyApp()); runApp(const MyApp());
print('Test suceeded'); print('Test suceeded');
} }
class MyApp extends StatelessWidget { class MyApp extends StatelessWidget {
const MyApp({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return MaterialApp( return MaterialApp(
...@@ -21,12 +23,14 @@ class MyApp extends StatelessWidget { ...@@ -21,12 +23,14 @@ class MyApp extends StatelessWidget {
theme: ThemeData( theme: ThemeData(
primarySwatch: Colors.blue, primarySwatch: Colors.blue,
), ),
home: HomePage(), home: const HomePage(),
); );
} }
} }
class HomePage extends StatefulWidget { class HomePage extends StatefulWidget {
const HomePage({Key key}) : super(key: key);
@override @override
_HomePage createState() => _HomePage(); _HomePage createState() => _HomePage();
} }
...@@ -40,7 +44,7 @@ class _HomePage extends State<HomePage> { ...@@ -40,7 +44,7 @@ class _HomePage extends State<HomePage> {
// https://github.com/flutter/flutter/issues/40126 // https://github.com/flutter/flutter/issues/40126
WidgetsBinding.instance.addPostFrameCallback((_) async { WidgetsBinding.instance.addPostFrameCallback((_) async {
Navigator.of(context).push( Navigator.of(context).push(
MaterialPageRoute<void>(builder: (_) => SecondPage())); MaterialPageRoute<void>(builder: (_) => const SecondPage()));
}); });
} }
...@@ -51,6 +55,8 @@ class _HomePage extends State<HomePage> { ...@@ -51,6 +55,8 @@ class _HomePage extends State<HomePage> {
} }
class SecondPage extends StatelessWidget { class SecondPage extends StatelessWidget {
const SecondPage({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
......
...@@ -43,14 +43,14 @@ Future<String> dataHandler(String message) async { ...@@ -43,14 +43,14 @@ Future<String> dataHandler(String message) async {
} }
Map<String, WidgetBuilder> routes = <String, WidgetBuilder>{ Map<String, WidgetBuilder> routes = <String, WidgetBuilder>{
selectionControlsRoute : (BuildContext context) => SelectionControlsPage(), selectionControlsRoute : (BuildContext context) => const SelectionControlsPage(),
popupControlsRoute : (BuildContext context) => PopupControlsPage(), popupControlsRoute : (BuildContext context) => const PopupControlsPage(),
textFieldRoute : (BuildContext context) => TextFieldPage(), textFieldRoute : (BuildContext context) => const TextFieldPage(),
headingsRoute: (BuildContext context) => HeadingsPage(), headingsRoute: (BuildContext context) => const HeadingsPage(),
}; };
class TestApp extends StatelessWidget { class TestApp extends StatelessWidget {
const TestApp(); const TestApp({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
......
...@@ -9,6 +9,8 @@ export 'controls_constants.dart'; ...@@ -9,6 +9,8 @@ export 'controls_constants.dart';
/// A test page with a checkbox, three radio buttons, and a switch. /// A test page with a checkbox, three radio buttons, and a switch.
class SelectionControlsPage extends StatefulWidget { class SelectionControlsPage extends StatefulWidget {
const SelectionControlsPage({Key key}) : super(key: key);
@override @override
State<StatefulWidget> createState() => _SelectionControlsPageState(); State<StatefulWidget> createState() => _SelectionControlsPageState();
} }
......
...@@ -9,6 +9,8 @@ export 'headings_constants.dart'; ...@@ -9,6 +9,8 @@ export 'headings_constants.dart';
/// A test page with an app bar and some body text for testing heading flags. /// A test page with an app bar and some body text for testing heading flags.
class HeadingsPage extends StatelessWidget { class HeadingsPage extends StatelessWidget {
const HeadingsPage({Key key}) : super(key: key);
static const ValueKey<String> _appBarTitleKey = ValueKey<String>(appBarTitleKeyValue); static const ValueKey<String> _appBarTitleKey = ValueKey<String>(appBarTitleKeyValue);
static const ValueKey<String> _bodyTextKey = ValueKey<String>(bodyTextKeyValue); static const ValueKey<String> _bodyTextKey = ValueKey<String>(bodyTextKeyValue);
......
...@@ -10,6 +10,8 @@ export 'popup_constants.dart'; ...@@ -10,6 +10,8 @@ export 'popup_constants.dart';
/// A page with a popup menu, a dropdown menu, and a modal alert. /// A page with a popup menu, a dropdown menu, and a modal alert.
class PopupControlsPage extends StatefulWidget { class PopupControlsPage extends StatefulWidget {
const PopupControlsPage({Key key}) : super(key: key);
@override @override
State<StatefulWidget> createState() => _PopupControlsPageState(); State<StatefulWidget> createState() => _PopupControlsPageState();
} }
......
...@@ -10,6 +10,8 @@ export 'text_field_constants.dart'; ...@@ -10,6 +10,8 @@ export 'text_field_constants.dart';
/// A page with a normal text field and a password field. /// A page with a normal text field and a password field.
class TextFieldPage extends StatefulWidget { class TextFieldPage extends StatefulWidget {
const TextFieldPage({Key key}) : super(key: key);
@override @override
State<StatefulWidget> createState() => _TextFieldPageState(); State<StatefulWidget> createState() => _TextFieldPageState();
} }
......
...@@ -16,10 +16,12 @@ final List<PageWidget> _allPages = <PageWidget>[ ...@@ -16,10 +16,12 @@ final List<PageWidget> _allPages = <PageWidget>[
void main() { void main() {
enableFlutterDriverExtension(handler: driverDataHandler.handleMessage); enableFlutterDriverExtension(handler: driverDataHandler.handleMessage);
runApp(MaterialApp(home: Home())); runApp(const MaterialApp(home: Home()));
} }
class Home extends StatelessWidget { class Home extends StatelessWidget {
const Home({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
......
...@@ -18,12 +18,12 @@ MethodChannel channel = const MethodChannel('android_views_integration'); ...@@ -18,12 +18,12 @@ MethodChannel channel = const MethodChannel('android_views_integration');
const String kEventsFileName = 'touchEvents'; const String kEventsFileName = 'touchEvents';
class MotionEventsPage extends PageWidget { class MotionEventsPage extends PageWidget {
const MotionEventsPage() const MotionEventsPage({Key key})
: super('Motion Event Tests', const ValueKey<String>('MotionEventsListTile')); : super('Motion Event Tests', const ValueKey<String>('MotionEventsListTile'), key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return MotionEventsBody(); return const MotionEventsBody();
} }
} }
...@@ -44,6 +44,8 @@ class FutureDataHandler { ...@@ -44,6 +44,8 @@ class FutureDataHandler {
FutureDataHandler driverDataHandler = FutureDataHandler(); FutureDataHandler driverDataHandler = FutureDataHandler();
class MotionEventsBody extends StatefulWidget { class MotionEventsBody extends StatefulWidget {
const MotionEventsBody({Key key}) : super(key: key);
@override @override
State createState() => MotionEventsBodyState(); State createState() => MotionEventsBodyState();
} }
...@@ -251,7 +253,7 @@ class MotionEventsBodyState extends State<MotionEventsBody> { ...@@ -251,7 +253,7 @@ class MotionEventsBodyState extends State<MotionEventsBody> {
} }
class TouchEventDiff extends StatelessWidget { class TouchEventDiff extends StatelessWidget {
const TouchEventDiff(this.originalEvent, this.synthesizedEvent); const TouchEventDiff(this.originalEvent, this.synthesizedEvent, {Key key}) : super(key: key);
final Map<String, dynamic> originalEvent; final Map<String, dynamic> originalEvent;
final Map<String, dynamic> synthesizedEvent; final Map<String, dynamic> synthesizedEvent;
......
...@@ -8,7 +8,7 @@ import 'package:flutter/material.dart'; ...@@ -8,7 +8,7 @@ import 'package:flutter/material.dart';
// //
/// A testing page has to override this in order to be put as one of the items in the main page. /// A testing page has to override this in order to be put as one of the items in the main page.
abstract class PageWidget extends StatelessWidget { abstract class PageWidget extends StatelessWidget {
const PageWidget(this.title, this.tileKey); const PageWidget(this.title, this.tileKey, {Key key}) : super(key: key);
/// The title of the testing page /// The title of the testing page
/// ///
......
...@@ -10,14 +10,16 @@ import 'package:flutter/services.dart'; ...@@ -10,14 +10,16 @@ import 'package:flutter/services.dart';
import 'page.dart'; import 'page.dart';
class WindowManagerIntegrationsPage extends PageWidget { class WindowManagerIntegrationsPage extends PageWidget {
const WindowManagerIntegrationsPage() const WindowManagerIntegrationsPage({Key key})
: super('Window Manager Integrations Tests', const ValueKey<String>('WmIntegrationsListTile')); : super('Window Manager Integrations Tests', const ValueKey<String>('WmIntegrationsListTile'), key: key);
@override @override
Widget build(BuildContext context) => WindowManagerBody(); Widget build(BuildContext context) => const WindowManagerBody();
} }
class WindowManagerBody extends StatefulWidget { class WindowManagerBody extends StatefulWidget {
const WindowManagerBody({Key key}) : super(key: key);
@override @override
State<WindowManagerBody> createState() => WindowManagerBodyState(); State<WindowManagerBody> createState() => WindowManagerBodyState();
} }
......
...@@ -15,10 +15,12 @@ import 'src/test_step.dart'; ...@@ -15,10 +15,12 @@ import 'src/test_step.dart';
void main() { void main() {
enableFlutterDriverExtension(); enableFlutterDriverExtension();
runApp(TestApp()); runApp(const TestApp());
} }
class TestApp extends StatefulWidget { class TestApp extends StatefulWidget {
const TestApp({Key key}) : super(key: key);
@override @override
_TestAppState createState() => _TestAppState(); _TestAppState createState() => _TestAppState();
} }
......
...@@ -11,10 +11,12 @@ import 'package:flutter_driver/driver_extension.dart'; ...@@ -11,10 +11,12 @@ import 'package:flutter_driver/driver_extension.dart';
void main() { void main() {
enableFlutterDriverExtension(); enableFlutterDriverExtension();
debugPrint('Application starting...'); debugPrint('Application starting...');
runApp(MyApp()); runApp(const MyApp());
} }
class MyApp extends StatefulWidget { class MyApp extends StatefulWidget {
const MyApp({Key key}) : super(key: key);
@override @override
State createState() => MyAppState(); State createState() => MyAppState();
} }
......
...@@ -8,10 +8,12 @@ import 'package:flutter_driver/driver_extension.dart'; ...@@ -8,10 +8,12 @@ import 'package:flutter_driver/driver_extension.dart';
void main() { void main() {
enableFlutterDriverExtension(); enableFlutterDriverExtension();
runApp(Center(child: Flavor())); runApp(const Center(child: Flavor()));
} }
class Flavor extends StatefulWidget { class Flavor extends StatefulWidget {
const Flavor({Key key}) : super(key: key);
@override @override
_FlavorState createState() => _FlavorState(); _FlavorState createState() => _FlavorState();
} }
......
...@@ -138,7 +138,7 @@ class _CalculatorState extends State<Calculator> { ...@@ -138,7 +138,7 @@ class _CalculatorState extends State<Calculator> {
} }
class CalcDisplay extends StatelessWidget { class CalcDisplay extends StatelessWidget {
const CalcDisplay({ this.content }); const CalcDisplay({ Key? key, this.content}) : super(key: key);
final String? content; final String? content;
...@@ -154,7 +154,7 @@ class CalcDisplay extends StatelessWidget { ...@@ -154,7 +154,7 @@ class CalcDisplay extends StatelessWidget {
} }
class KeyPad extends StatelessWidget { class KeyPad extends StatelessWidget {
const KeyPad({ this.calcState }); const KeyPad({ Key? key, this.calcState }) : super(key: key);
final _CalculatorState? calcState; final _CalculatorState? calcState;
...@@ -222,7 +222,7 @@ class KeyPad extends StatelessWidget { ...@@ -222,7 +222,7 @@ class KeyPad extends StatelessWidget {
} }
class KeyRow extends StatelessWidget { class KeyRow extends StatelessWidget {
const KeyRow(this.keys); const KeyRow(this.keys, {Key? key}) : super(key: key);
final List<Widget> keys; final List<Widget> keys;
...@@ -238,7 +238,7 @@ class KeyRow extends StatelessWidget { ...@@ -238,7 +238,7 @@ class KeyRow extends StatelessWidget {
} }
class CalcKey extends StatelessWidget { class CalcKey extends StatelessWidget {
const CalcKey(this.text, this.onTap); const CalcKey(this.text, this.onTap, {Key? key}) : super(key: key);
final String text; final String text;
final GestureTapCallback onTap; final GestureTapCallback onTap;
...@@ -265,8 +265,8 @@ class CalcKey extends StatelessWidget { ...@@ -265,8 +265,8 @@ class CalcKey extends StatelessWidget {
} }
class NumberKey extends CalcKey { class NumberKey extends CalcKey {
NumberKey(int value, _CalculatorState? calcState) NumberKey(int value, _CalculatorState? calcState, {Key? key})
: super('$value', () { : super('$value', () {
calcState!.handleNumberTap(value); calcState!.handleNumberTap(value);
}); }, key: key);
} }
...@@ -120,6 +120,8 @@ class PaletteTabView extends StatelessWidget { ...@@ -120,6 +120,8 @@ class PaletteTabView extends StatelessWidget {
} }
class ColorsDemo extends StatelessWidget { class ColorsDemo extends StatelessWidget {
const ColorsDemo({Key? key}) : super(key: key);
static const String routeName = '/colors'; static const String routeName = '/colors';
@override @override
......
...@@ -86,6 +86,8 @@ class _ContactItem extends StatelessWidget { ...@@ -86,6 +86,8 @@ class _ContactItem extends StatelessWidget {
} }
class ContactsDemo extends StatefulWidget { class ContactsDemo extends StatefulWidget {
const ContactsDemo({Key? key}) : super(key: key);
static const String routeName = '/contacts'; static const String routeName = '/contacts';
@override @override
......
...@@ -7,6 +7,8 @@ import 'package:flutter/cupertino.dart'; ...@@ -7,6 +7,8 @@ import 'package:flutter/cupertino.dart';
import '../../gallery/demo.dart'; import '../../gallery/demo.dart';
class CupertinoProgressIndicatorDemo extends StatelessWidget { class CupertinoProgressIndicatorDemo extends StatelessWidget {
const CupertinoProgressIndicatorDemo({Key? key}) : super(key: key);
static const String routeName = '/cupertino/progress_indicator'; static const String routeName = '/cupertino/progress_indicator';
@override @override
......
...@@ -7,6 +7,8 @@ import 'package:flutter/cupertino.dart'; ...@@ -7,6 +7,8 @@ import 'package:flutter/cupertino.dart';
import '../../gallery/demo.dart'; import '../../gallery/demo.dart';
class CupertinoAlertDemo extends StatefulWidget { class CupertinoAlertDemo extends StatefulWidget {
const CupertinoAlertDemo({Key? key}) : super(key: key);
static const String routeName = '/cupertino/alert'; static const String routeName = '/cupertino/alert';
@override @override
......
...@@ -7,6 +7,8 @@ import 'package:flutter/cupertino.dart'; ...@@ -7,6 +7,8 @@ import 'package:flutter/cupertino.dart';
import '../../gallery/demo.dart'; import '../../gallery/demo.dart';
class CupertinoButtonsDemo extends StatefulWidget { class CupertinoButtonsDemo extends StatefulWidget {
const CupertinoButtonsDemo({Key? key}) : super(key: key);
static const String routeName = '/cupertino/buttons'; static const String routeName = '/cupertino/buttons';
@override @override
......
...@@ -32,13 +32,14 @@ const List<String> coolColorNames = <String>[ ...@@ -32,13 +32,14 @@ const List<String> coolColorNames = <String>[
const int _kChildCount = 50; const int _kChildCount = 50;
class CupertinoNavigationDemo extends StatelessWidget { class CupertinoNavigationDemo extends StatelessWidget {
CupertinoNavigationDemo({ this.randomSeed }) CupertinoNavigationDemo({ Key? key, this.randomSeed })
: colorItems = List<Color>.generate(_kChildCount, (int index) { : colorItems = List<Color>.generate(_kChildCount, (int index) {
return coolColors[math.Random(randomSeed).nextInt(coolColors.length)]; return coolColors[math.Random(randomSeed).nextInt(coolColors.length)];
}) , }) ,
colorNameItems = List<String>.generate(_kChildCount, (int index) { colorNameItems = List<String>.generate(_kChildCount, (int index) {
return coolColorNames[math.Random(randomSeed).nextInt(coolColorNames.length)]; return coolColorNames[math.Random(randomSeed).nextInt(coolColorNames.length)];
}); }),
super(key: key);
static const String routeName = '/cupertino/navigation'; static const String routeName = '/cupertino/navigation';
...@@ -85,12 +86,12 @@ class CupertinoNavigationDemo extends StatelessWidget { ...@@ -85,12 +86,12 @@ class CupertinoNavigationDemo extends StatelessWidget {
); );
case 1: case 1:
return CupertinoTabView( return CupertinoTabView(
builder: (BuildContext context) => CupertinoDemoTab2(), builder: (BuildContext context) => const CupertinoDemoTab2(),
defaultTitle: 'Support Chat', defaultTitle: 'Support Chat',
); );
case 2: case 2:
return CupertinoTabView( return CupertinoTabView(
builder: (BuildContext context) => CupertinoDemoTab3(), builder: (BuildContext context) => const CupertinoDemoTab3(),
defaultTitle: 'Account', defaultTitle: 'Account',
); );
} }
...@@ -104,7 +105,7 @@ class CupertinoNavigationDemo extends StatelessWidget { ...@@ -104,7 +105,7 @@ class CupertinoNavigationDemo extends StatelessWidget {
} }
class ExitButton extends StatelessWidget { class ExitButton extends StatelessWidget {
const ExitButton(); const ExitButton({Key? key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
...@@ -134,10 +135,11 @@ final Widget trailingButtons = Row( ...@@ -134,10 +135,11 @@ final Widget trailingButtons = Row(
class CupertinoDemoTab1 extends StatelessWidget { class CupertinoDemoTab1 extends StatelessWidget {
const CupertinoDemoTab1({ const CupertinoDemoTab1({
Key? key,
this.colorItems, this.colorItems,
this.colorNameItems, this.colorNameItems,
this.randomSeed, this.randomSeed,
}); }) : super(key: key);
final List<Color>? colorItems; final List<Color>? colorItems;
final List<String>? colorNameItems; final List<String>? colorNameItems;
...@@ -184,12 +186,13 @@ class CupertinoDemoTab1 extends StatelessWidget { ...@@ -184,12 +186,13 @@ class CupertinoDemoTab1 extends StatelessWidget {
class Tab1RowItem extends StatelessWidget { class Tab1RowItem extends StatelessWidget {
const Tab1RowItem({ const Tab1RowItem({
Key? key,
this.index, this.index,
this.lastItem, this.lastItem,
this.color, this.color,
this.colorName, this.colorName,
this.randomSeed, this.randomSeed,
}); }) : super(key: key);
final int? index; final int? index;
final bool? lastItem; final bool? lastItem;
...@@ -287,7 +290,7 @@ class Tab1RowItem extends StatelessWidget { ...@@ -287,7 +290,7 @@ class Tab1RowItem extends StatelessWidget {
} }
class Tab1ItemPage extends StatefulWidget { class Tab1ItemPage extends StatefulWidget {
const Tab1ItemPage({this.color, this.colorName, this.index, this.randomSeed}); const Tab1ItemPage({Key? key, this.color, this.colorName, this.index, this.randomSeed}) : super(key: key);
final Color? color; final Color? color;
final String? colorName; final String? colorName;
...@@ -441,6 +444,8 @@ class Tab1ItemPageState extends State<Tab1ItemPage> { ...@@ -441,6 +444,8 @@ class Tab1ItemPageState extends State<Tab1ItemPage> {
} }
class CupertinoDemoTab2 extends StatelessWidget { class CupertinoDemoTab2 extends StatelessWidget {
const CupertinoDemoTab2({Key? key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return CupertinoPageScaffold( return CupertinoPageScaffold(
...@@ -450,7 +455,7 @@ class CupertinoDemoTab2 extends StatelessWidget { ...@@ -450,7 +455,7 @@ class CupertinoDemoTab2 extends StatelessWidget {
child: CupertinoScrollbar( child: CupertinoScrollbar(
child: ListView( child: ListView(
children: <Widget>[ children: <Widget>[
CupertinoUserInterfaceLevel( const CupertinoUserInterfaceLevel(
data: CupertinoUserInterfaceLevelData.elevated, data: CupertinoUserInterfaceLevelData.elevated,
child: Tab2Header(), child: Tab2Header(),
), ),
...@@ -463,6 +468,8 @@ class CupertinoDemoTab2 extends StatelessWidget { ...@@ -463,6 +468,8 @@ class CupertinoDemoTab2 extends StatelessWidget {
} }
class Tab2Header extends StatelessWidget { class Tab2Header extends StatelessWidget {
const Tab2Header({Key? key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Padding( return Padding(
...@@ -589,7 +596,7 @@ enum Tab2ConversationBubbleColor { ...@@ -589,7 +596,7 @@ enum Tab2ConversationBubbleColor {
} }
class Tab2ConversationBubble extends StatelessWidget { class Tab2ConversationBubble extends StatelessWidget {
const Tab2ConversationBubble({this.text, this.color}); const Tab2ConversationBubble({Key? key, this.text, this.color}) : super(key: key);
final String? text; final String? text;
final Tab2ConversationBubbleColor? color; final Tab2ConversationBubbleColor? color;
...@@ -633,7 +640,7 @@ class Tab2ConversationBubble extends StatelessWidget { ...@@ -633,7 +640,7 @@ class Tab2ConversationBubble extends StatelessWidget {
} }
class Tab2ConversationAvatar extends StatelessWidget { class Tab2ConversationAvatar extends StatelessWidget {
const Tab2ConversationAvatar({this.text, this.color}); const Tab2ConversationAvatar({Key? key, this.text, this.color}) : super(key: key);
final String? text; final String? text;
final Color? color; final Color? color;
...@@ -672,7 +679,7 @@ class Tab2ConversationAvatar extends StatelessWidget { ...@@ -672,7 +679,7 @@ class Tab2ConversationAvatar extends StatelessWidget {
} }
class Tab2ConversationRow extends StatelessWidget { class Tab2ConversationRow extends StatelessWidget {
const Tab2ConversationRow({this.avatar, this.text}); const Tab2ConversationRow({Key? key, this.avatar, this.text}) : super(key: key);
final Tab2ConversationAvatar? avatar; final Tab2ConversationAvatar? avatar;
final String? text; final String? text;
...@@ -742,6 +749,8 @@ List<Widget> buildTab2Conversation() { ...@@ -742,6 +749,8 @@ List<Widget> buildTab2Conversation() {
} }
class CupertinoDemoTab3 extends StatelessWidget { class CupertinoDemoTab3 extends StatelessWidget {
const CupertinoDemoTab3({Key? key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return CupertinoPageScaffold( return CupertinoPageScaffold(
...@@ -755,7 +764,7 @@ class CupertinoDemoTab3 extends StatelessWidget { ...@@ -755,7 +764,7 @@ class CupertinoDemoTab3 extends StatelessWidget {
Navigator.of(context, rootNavigator: true).push( Navigator.of(context, rootNavigator: true).push(
CupertinoPageRoute<bool>( CupertinoPageRoute<bool>(
fullscreenDialog: true, fullscreenDialog: true,
builder: (BuildContext context) => Tab3Dialog(), builder: (BuildContext context) => const Tab3Dialog(),
), ),
); );
}, },
...@@ -792,6 +801,8 @@ class CupertinoDemoTab3 extends StatelessWidget { ...@@ -792,6 +801,8 @@ class CupertinoDemoTab3 extends StatelessWidget {
} }
class Tab3Dialog extends StatelessWidget { class Tab3Dialog extends StatelessWidget {
const Tab3Dialog({Key? key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return CupertinoPageScaffold( return CupertinoPageScaffold(
......
...@@ -12,6 +12,8 @@ const double _kPickerSheetHeight = 216.0; ...@@ -12,6 +12,8 @@ const double _kPickerSheetHeight = 216.0;
const double _kPickerItemHeight = 32.0; const double _kPickerItemHeight = 32.0;
class CupertinoPickerDemo extends StatefulWidget { class CupertinoPickerDemo extends StatefulWidget {
const CupertinoPickerDemo({Key? key}) : super(key: key);
static const String routeName = '/cupertino/picker'; static const String routeName = '/cupertino/picker';
@override @override
......
...@@ -9,6 +9,8 @@ import 'package:flutter/cupertino.dart'; ...@@ -9,6 +9,8 @@ import 'package:flutter/cupertino.dart';
import '../../gallery/demo.dart'; import '../../gallery/demo.dart';
class CupertinoRefreshControlDemo extends StatefulWidget { class CupertinoRefreshControlDemo extends StatefulWidget {
const CupertinoRefreshControlDemo({Key? key}) : super(key: key);
static const String routeName = '/cupertino/refresh'; static const String routeName = '/cupertino/refresh';
@override @override
......
...@@ -12,6 +12,8 @@ const Color _kKeyPenumbraOpacity = Color(0x24000000); // alpha = 0.14 ...@@ -12,6 +12,8 @@ const Color _kKeyPenumbraOpacity = Color(0x24000000); // alpha = 0.14
const Color _kAmbientShadowOpacity = Color(0x1F000000); // alpha = 0.12 const Color _kAmbientShadowOpacity = Color(0x1F000000); // alpha = 0.12
class CupertinoSegmentedControlDemo extends StatefulWidget { class CupertinoSegmentedControlDemo extends StatefulWidget {
const CupertinoSegmentedControlDemo({Key? key}) : super(key: key);
static const String routeName = 'cupertino/segmented_control'; static const String routeName = 'cupertino/segmented_control';
@override @override
......
...@@ -7,6 +7,8 @@ import 'package:flutter/cupertino.dart'; ...@@ -7,6 +7,8 @@ import 'package:flutter/cupertino.dart';
import '../../gallery/demo.dart'; import '../../gallery/demo.dart';
class CupertinoSliderDemo extends StatefulWidget { class CupertinoSliderDemo extends StatefulWidget {
const CupertinoSliderDemo({Key? key}) : super(key: key);
static const String routeName = '/cupertino/slider'; static const String routeName = '/cupertino/slider';
@override @override
......
...@@ -7,6 +7,8 @@ import 'package:flutter/cupertino.dart'; ...@@ -7,6 +7,8 @@ import 'package:flutter/cupertino.dart';
import '../../gallery/demo.dart'; import '../../gallery/demo.dart';
class CupertinoSwitchDemo extends StatefulWidget { class CupertinoSwitchDemo extends StatefulWidget {
const CupertinoSwitchDemo({Key? key}) : super(key: key);
static const String routeName = '/cupertino/switch'; static const String routeName = '/cupertino/switch';
@override @override
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
class CupertinoTextFieldDemo extends StatefulWidget { class CupertinoTextFieldDemo extends StatefulWidget {
const CupertinoTextFieldDemo({Key? key}) : super(key: key);
static const String routeName = '/cupertino/text_fields'; static const String routeName = '/cupertino/text_fields';
@override @override
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class FortnightlyDemo extends StatelessWidget { class FortnightlyDemo extends StatelessWidget {
const FortnightlyDemo({Key? key}) : super(key: key);
static const String routeName = '/fortnightly'; static const String routeName = '/fortnightly';
@override @override
...@@ -15,7 +17,7 @@ class FortnightlyDemo extends StatelessWidget { ...@@ -15,7 +17,7 @@ class FortnightlyDemo extends StatelessWidget {
home: Scaffold( home: Scaffold(
body: Stack( body: Stack(
children: <Widget>[ children: <Widget>[
FruitPage(), const FruitPage(),
SafeArea( SafeArea(
child: ShortAppBar( child: ShortAppBar(
onBackPressed: () { onBackPressed: () {
...@@ -31,7 +33,7 @@ class FortnightlyDemo extends StatelessWidget { ...@@ -31,7 +33,7 @@ class FortnightlyDemo extends StatelessWidget {
} }
class ShortAppBar extends StatelessWidget { class ShortAppBar extends StatelessWidget {
const ShortAppBar({ this.onBackPressed }); const ShortAppBar({ Key? key, this.onBackPressed }) : super(key: key);
final VoidCallback? onBackPressed; final VoidCallback? onBackPressed;
...@@ -66,6 +68,8 @@ class ShortAppBar extends StatelessWidget { ...@@ -66,6 +68,8 @@ class ShortAppBar extends StatelessWidget {
} }
class FruitPage extends StatelessWidget { class FruitPage extends StatelessWidget {
const FruitPage({Key? key}) : super(key: key);
static final String paragraph1 = ''' static final String paragraph1 = '''
Have you ever held a quince? It's strange; Have you ever held a quince? It's strange;
covered in a fuzz somewhere between peach skin and a spider web. And it's covered in a fuzz somewhere between peach skin and a spider web. And it's
......
...@@ -7,6 +7,8 @@ import 'package:flutter/material.dart'; ...@@ -7,6 +7,8 @@ import 'package:flutter/material.dart';
import '../gallery/demo.dart'; import '../gallery/demo.dart';
class ImagesDemo extends StatelessWidget { class ImagesDemo extends StatelessWidget {
const ImagesDemo({Key? key}) : super(key: key);
static const String routeName = '/images'; static const String routeName = '/images';
@override @override
......
...@@ -239,6 +239,8 @@ class BackdropTitle extends AnimatedWidget { ...@@ -239,6 +239,8 @@ class BackdropTitle extends AnimatedWidget {
// This widget is essentially the backdrop itself. // This widget is essentially the backdrop itself.
class BackdropDemo extends StatefulWidget { class BackdropDemo extends StatefulWidget {
const BackdropDemo({Key? key}) : super(key: key);
static const String routeName = '/material/backdrop'; static const String routeName = '/material/backdrop';
@override @override
......
...@@ -7,6 +7,8 @@ import 'package:flutter/material.dart'; ...@@ -7,6 +7,8 @@ import 'package:flutter/material.dart';
import '../../gallery/demo.dart'; import '../../gallery/demo.dart';
class BottomAppBarDemo extends StatefulWidget { class BottomAppBarDemo extends StatefulWidget {
const BottomAppBarDemo({Key? key}) : super(key: key);
static const String routeName = '/material/bottom_app_bar'; static const String routeName = '/material/bottom_app_bar';
@override @override
......
...@@ -74,6 +74,8 @@ class NavigationIconView { ...@@ -74,6 +74,8 @@ class NavigationIconView {
} }
class CustomIcon extends StatelessWidget { class CustomIcon extends StatelessWidget {
const CustomIcon({Key? key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final IconThemeData iconTheme = IconTheme.of(context); final IconThemeData iconTheme = IconTheme.of(context);
...@@ -87,6 +89,8 @@ class CustomIcon extends StatelessWidget { ...@@ -87,6 +89,8 @@ class CustomIcon extends StatelessWidget {
} }
class CustomInactiveIcon extends StatelessWidget { class CustomInactiveIcon extends StatelessWidget {
const CustomInactiveIcon({Key? key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final IconThemeData iconTheme = IconTheme.of(context); final IconThemeData iconTheme = IconTheme.of(context);
...@@ -102,6 +106,8 @@ class CustomInactiveIcon extends StatelessWidget { ...@@ -102,6 +106,8 @@ class CustomInactiveIcon extends StatelessWidget {
} }
class BottomNavigationDemo extends StatefulWidget { class BottomNavigationDemo extends StatefulWidget {
const BottomNavigationDemo({Key? key}) : super(key: key);
static const String routeName = '/material/bottom_navigation'; static const String routeName = '/material/bottom_navigation';
@override @override
...@@ -125,8 +131,8 @@ class _BottomNavigationDemoState extends State<BottomNavigationDemo> ...@@ -125,8 +131,8 @@ class _BottomNavigationDemoState extends State<BottomNavigationDemo>
vsync: this, vsync: this,
), ),
NavigationIconView( NavigationIconView(
activeIcon: CustomIcon(), activeIcon: const CustomIcon(),
icon: CustomInactiveIcon(), icon: const CustomInactiveIcon(),
title: 'Box', title: 'Box',
color: Colors.deepOrange, color: Colors.deepOrange,
vsync: this, vsync: this,
......
...@@ -46,6 +46,8 @@ const String _actionText = ...@@ -46,6 +46,8 @@ const String _actionText =
const String _actionCode = 'buttons_action'; const String _actionCode = 'buttons_action';
class ButtonsDemo extends StatefulWidget { class ButtonsDemo extends StatefulWidget {
const ButtonsDemo({Key? key}) : super(key: key);
static const String routeName = '/material/buttons'; static const String routeName = '/material/buttons';
@override @override
......
...@@ -335,6 +335,8 @@ class TravelDestinationContent extends StatelessWidget { ...@@ -335,6 +335,8 @@ class TravelDestinationContent extends StatelessWidget {
} }
class CardsDemo extends StatefulWidget { class CardsDemo extends StatefulWidget {
const CardsDemo({Key? key}) : super(key: key);
static const String routeName = '/material/cards'; static const String routeName = '/material/cards';
@override @override
......
...@@ -135,6 +135,8 @@ class _ChipsTile extends StatelessWidget { ...@@ -135,6 +135,8 @@ class _ChipsTile extends StatelessWidget {
} }
class ChipDemo extends StatefulWidget { class ChipDemo extends StatefulWidget {
const ChipDemo({Key? key}) : super(key: key);
static const String routeName = '/material/chip'; static const String routeName = '/material/chip';
@override @override
......
...@@ -142,6 +142,8 @@ class DessertDataSource extends DataTableSource { ...@@ -142,6 +142,8 @@ class DessertDataSource extends DataTableSource {
} }
class DataTableDemo extends StatefulWidget { class DataTableDemo extends StatefulWidget {
const DataTableDemo({Key? key}) : super(key: key);
static const String routeName = '/material/data-table'; static const String routeName = '/material/data-table';
@override @override
......
...@@ -113,6 +113,8 @@ class _DateTimePicker extends StatelessWidget { ...@@ -113,6 +113,8 @@ class _DateTimePicker extends StatelessWidget {
} }
class DateAndTimePickerDemo extends StatefulWidget { class DateAndTimePickerDemo extends StatefulWidget {
const DateAndTimePickerDemo({Key? key}) : super(key: key);
static const String routeName = '/material/date-and-time-pickers'; static const String routeName = '/material/date-and-time-pickers';
@override @override
......
...@@ -48,6 +48,8 @@ class DialogDemoItem extends StatelessWidget { ...@@ -48,6 +48,8 @@ class DialogDemoItem extends StatelessWidget {
} }
class DialogDemo extends StatefulWidget { class DialogDemo extends StatefulWidget {
const DialogDemo({Key? key}) : super(key: key);
static const String routeName = '/material/dialog'; static const String routeName = '/material/dialog';
@override @override
...@@ -192,7 +194,7 @@ class DialogDemoState extends State<DialogDemo> { ...@@ -192,7 +194,7 @@ class DialogDemoState extends State<DialogDemo> {
child: const Text('FULLSCREEN'), child: const Text('FULLSCREEN'),
onPressed: () { onPressed: () {
Navigator.push(context, MaterialPageRoute<DismissDialogAction>( Navigator.push(context, MaterialPageRoute<DismissDialogAction>(
builder: (BuildContext context) => FullScreenDialogDemo(), builder: (BuildContext context) => const FullScreenDialogDemo(),
fullscreenDialog: true, fullscreenDialog: true,
)); ));
}, },
......
...@@ -13,6 +13,8 @@ const String _kAsset2 = 'people/square/sandra.png'; ...@@ -13,6 +13,8 @@ const String _kAsset2 = 'people/square/sandra.png';
const String _kGalleryAssetsPackage = 'flutter_gallery_assets'; const String _kGalleryAssetsPackage = 'flutter_gallery_assets';
class DrawerDemo extends StatefulWidget { class DrawerDemo extends StatefulWidget {
const DrawerDemo({Key? key}) : super(key: key);
static const String routeName = '/material/drawer'; static const String routeName = '/material/drawer';
@override @override
......
...@@ -7,6 +7,8 @@ import 'package:flutter/material.dart'; ...@@ -7,6 +7,8 @@ import 'package:flutter/material.dart';
import '../../gallery/demo.dart'; import '../../gallery/demo.dart';
class ElevationDemo extends StatefulWidget { class ElevationDemo extends StatefulWidget {
const ElevationDemo({Key? key}) : super(key: key);
static const String routeName = '/material/elevation'; static const String routeName = '/material/elevation';
@override @override
......
...@@ -18,11 +18,12 @@ typedef ValueToString<T> = String? Function(T value); ...@@ -18,11 +18,12 @@ typedef ValueToString<T> = String? Function(T value);
class DualHeaderWithHint extends StatelessWidget { class DualHeaderWithHint extends StatelessWidget {
const DualHeaderWithHint({ const DualHeaderWithHint({
Key? key,
this.name, this.name,
this.value, this.value,
this.hint, this.hint,
this.showHint, this.showHint,
}); }) : super(key: key);
final String? name; final String? name;
final String? value; final String? value;
...@@ -80,11 +81,12 @@ class DualHeaderWithHint extends StatelessWidget { ...@@ -80,11 +81,12 @@ class DualHeaderWithHint extends StatelessWidget {
class CollapsibleBody extends StatelessWidget { class CollapsibleBody extends StatelessWidget {
const CollapsibleBody({ const CollapsibleBody({
Key? key,
this.margin = EdgeInsets.zero, this.margin = EdgeInsets.zero,
this.child, this.child,
this.onSave, this.onSave,
this.onCancel, this.onCancel,
}); }) : super(key: key);
final EdgeInsets margin; final EdgeInsets margin;
final Widget? child; final Widget? child;
...@@ -175,6 +177,8 @@ class DemoItem<T> { ...@@ -175,6 +177,8 @@ class DemoItem<T> {
} }
class ExpansionPanelsDemo extends StatefulWidget { class ExpansionPanelsDemo extends StatefulWidget {
const ExpansionPanelsDemo({Key? key}) : super(key: key);
static const String routeName = '/material/expansion_panels'; static const String routeName = '/material/expansion_panels';
@override @override
......
...@@ -7,6 +7,8 @@ import 'package:flutter/material.dart'; ...@@ -7,6 +7,8 @@ import 'package:flutter/material.dart';
import '../../gallery/demo.dart'; import '../../gallery/demo.dart';
class ExpansionTileListDemo extends StatelessWidget { class ExpansionTileListDemo extends StatelessWidget {
const ExpansionTileListDemo({Key? key}) : super(key: key);
static const String routeName = '/material/expansion-tile-list'; static const String routeName = '/material/expansion-tile-list';
@override @override
......
...@@ -93,6 +93,8 @@ class DateTimeItem extends StatelessWidget { ...@@ -93,6 +93,8 @@ class DateTimeItem extends StatelessWidget {
} }
class FullScreenDialogDemo extends StatefulWidget { class FullScreenDialogDemo extends StatefulWidget {
const FullScreenDialogDemo({Key? key}) : super(key: key);
@override @override
FullScreenDialogDemoState createState() => FullScreenDialogDemoState(); FullScreenDialogDemoState createState() => FullScreenDialogDemoState();
} }
......
...@@ -7,6 +7,8 @@ import 'package:flutter/material.dart'; ...@@ -7,6 +7,8 @@ import 'package:flutter/material.dart';
import '../../gallery/demo.dart'; import '../../gallery/demo.dart';
class IconsDemo extends StatefulWidget { class IconsDemo extends StatefulWidget {
const IconsDemo({Key? key}) : super(key: key);
static const String routeName = '/material/icons'; static const String routeName = '/material/icons';
@override @override
......
...@@ -7,6 +7,8 @@ import 'package:flutter/material.dart'; ...@@ -7,6 +7,8 @@ import 'package:flutter/material.dart';
import '../../gallery/demo.dart'; import '../../gallery/demo.dart';
class ModalBottomSheetDemo extends StatelessWidget { class ModalBottomSheetDemo extends StatelessWidget {
const ModalBottomSheetDemo({Key? key}) : super(key: key);
static const String routeName = '/material/modal-bottom-sheet'; static const String routeName = '/material/modal-bottom-sheet';
@override @override
......
...@@ -74,6 +74,8 @@ class _PageSelector extends StatelessWidget { ...@@ -74,6 +74,8 @@ class _PageSelector extends StatelessWidget {
} }
class PageSelectorDemo extends StatelessWidget { class PageSelectorDemo extends StatelessWidget {
const PageSelectorDemo({Key? key}) : super(key: key);
static const String routeName = '/material/page-selector'; static const String routeName = '/material/page-selector';
static final List<Icon> icons = <Icon>[ static final List<Icon> icons = <Icon>[
const Icon(Icons.event, semanticLabel: 'Event'), const Icon(Icons.event, semanticLabel: 'Event'),
......
...@@ -7,6 +7,8 @@ import 'package:flutter/material.dart'; ...@@ -7,6 +7,8 @@ import 'package:flutter/material.dart';
import '../../gallery/demo.dart'; import '../../gallery/demo.dart';
class PersistentBottomSheetDemo extends StatefulWidget { class PersistentBottomSheetDemo extends StatefulWidget {
const PersistentBottomSheetDemo({Key? key}) : super(key: key);
static const String routeName = '/material/persistent-bottom-sheet'; static const String routeName = '/material/persistent-bottom-sheet';
@override @override
......
...@@ -7,6 +7,8 @@ import 'package:flutter/material.dart'; ...@@ -7,6 +7,8 @@ import 'package:flutter/material.dart';
import '../../gallery/demo.dart'; import '../../gallery/demo.dart';
class ProgressIndicatorDemo extends StatefulWidget { class ProgressIndicatorDemo extends StatefulWidget {
const ProgressIndicatorDemo({Key? key}) : super(key: key);
static const String routeName = '/material/progress-indicator'; static const String routeName = '/material/progress-indicator';
@override @override
......
...@@ -36,6 +36,8 @@ const List<_Page> _allPages = <_Page>[ ...@@ -36,6 +36,8 @@ const List<_Page> _allPages = <_Page>[
]; ];
class ScrollableTabsDemo extends StatefulWidget { class ScrollableTabsDemo extends StatefulWidget {
const ScrollableTabsDemo({Key? key}) : super(key: key);
static const String routeName = '/material/scrollable-tabs'; static const String routeName = '/material/scrollable-tabs';
@override @override
......
...@@ -7,6 +7,8 @@ import 'package:flutter/material.dart'; ...@@ -7,6 +7,8 @@ import 'package:flutter/material.dart';
import '../../gallery/demo.dart'; import '../../gallery/demo.dart';
class SearchDemo extends StatefulWidget { class SearchDemo extends StatefulWidget {
const SearchDemo({Key? key}) : super(key: key);
static const String routeName = '/material/search'; static const String routeName = '/material/search';
@override @override
......
...@@ -28,6 +28,8 @@ const String _switchText = ...@@ -28,6 +28,8 @@ const String _switchText =
const String _switchCode = 'selectioncontrols_switch'; const String _switchCode = 'selectioncontrols_switch';
class SelectionControlsDemo extends StatefulWidget { class SelectionControlsDemo extends StatefulWidget {
const SelectionControlsDemo({Key? key}) : super(key: key);
static const String routeName = '/material/selection-controls'; static const String routeName = '/material/selection-controls';
@override @override
......
...@@ -9,6 +9,8 @@ import 'package:flutter/material.dart'; ...@@ -9,6 +9,8 @@ import 'package:flutter/material.dart';
import '../../gallery/demo.dart'; import '../../gallery/demo.dart';
class SliderDemo extends StatefulWidget { class SliderDemo extends StatefulWidget {
const SliderDemo({Key? key}) : super(key: key);
static const String routeName = '/material/slider'; static const String routeName = '/material/slider';
@override @override
......
...@@ -138,6 +138,8 @@ class _CardDataItem extends StatelessWidget { ...@@ -138,6 +138,8 @@ class _CardDataItem extends StatelessWidget {
} }
class TabsDemo extends StatelessWidget { class TabsDemo extends StatelessWidget {
const TabsDemo({Key? key}) : super(key: key);
static const String routeName = '/material/tabs'; static const String routeName = '/material/tabs';
@override @override
......
...@@ -35,6 +35,8 @@ final List<_Page> _allPages = <_Page>[ ...@@ -35,6 +35,8 @@ final List<_Page> _allPages = <_Page>[
]; ];
class TabsFabDemo extends StatefulWidget { class TabsFabDemo extends StatefulWidget {
const TabsFabDemo({Key? key}) : super(key: key);
static const String routeName = '/material/tabs-fab'; static const String routeName = '/material/tabs-fab';
@override @override
......
...@@ -26,6 +26,7 @@ class PersonData { ...@@ -26,6 +26,7 @@ class PersonData {
class PasswordField extends StatefulWidget { class PasswordField extends StatefulWidget {
const PasswordField({ const PasswordField({
Key? key,
this.fieldKey, this.fieldKey,
this.hintText, this.hintText,
this.labelText, this.labelText,
...@@ -33,7 +34,7 @@ class PasswordField extends StatefulWidget { ...@@ -33,7 +34,7 @@ class PasswordField extends StatefulWidget {
this.onSaved, this.onSaved,
this.validator, this.validator,
this.onFieldSubmitted, this.onFieldSubmitted,
}); }) : super(key: key);
final Key? fieldKey; final Key? fieldKey;
final String? hintText; final String? hintText;
......
...@@ -12,6 +12,7 @@ const String _introText = ...@@ -12,6 +12,7 @@ const String _introText =
'apps accessible, like screen readers.'; 'apps accessible, like screen readers.';
class TooltipDemo extends StatelessWidget { class TooltipDemo extends StatelessWidget {
const TooltipDemo({Key? key}) : super(key: key);
static const String routeName = '/material/tooltips'; static const String routeName = '/material/tooltips';
......
...@@ -10,7 +10,7 @@ class PestoDemo extends StatelessWidget { ...@@ -10,7 +10,7 @@ class PestoDemo extends StatelessWidget {
static const String routeName = '/pesto'; static const String routeName = '/pesto';
@override @override
Widget build(BuildContext context) => PestoHome(); Widget build(BuildContext context) => const PestoHome();
} }
...@@ -29,6 +29,8 @@ final ThemeData _kTheme = ThemeData( ...@@ -29,6 +29,8 @@ final ThemeData _kTheme = ThemeData(
); );
class PestoHome extends StatelessWidget { class PestoHome extends StatelessWidget {
const PestoHome({Key? key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return const RecipeGridPage(recipes: kPestoRecipes); return const RecipeGridPage(recipes: kPestoRecipes);
...@@ -36,6 +38,8 @@ class PestoHome extends StatelessWidget { ...@@ -36,6 +38,8 @@ class PestoHome extends StatelessWidget {
} }
class PestoFavorites extends StatelessWidget { class PestoFavorites extends StatelessWidget {
const PestoFavorites({Key? key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return RecipeGridPage(recipes: _favoriteRecipes.toList()); return RecipeGridPage(recipes: _favoriteRecipes.toList());
...@@ -167,7 +171,7 @@ class _RecipeGridPageState extends State<RecipeGridPage> { ...@@ -167,7 +171,7 @@ class _RecipeGridPageState extends State<RecipeGridPage> {
void showFavoritesPage(BuildContext context) { void showFavoritesPage(BuildContext context) {
Navigator.push(context, MaterialPageRoute<void>( Navigator.push(context, MaterialPageRoute<void>(
settings: const RouteSettings(name: '/pesto/favorites'), settings: const RouteSettings(name: '/pesto/favorites'),
builder: (BuildContext context) => PestoFavorites(), builder: (BuildContext context) => const PestoFavorites(),
)); ));
} }
...@@ -185,7 +189,7 @@ class _RecipeGridPageState extends State<RecipeGridPage> { ...@@ -185,7 +189,7 @@ class _RecipeGridPageState extends State<RecipeGridPage> {
} }
class PestoLogo extends StatefulWidget { class PestoLogo extends StatefulWidget {
const PestoLogo({this.height, this.t}); const PestoLogo({Key? key, this.height, this.t}) : super(key: key);
final double? height; final double? height;
final double? t; final double? t;
......
...@@ -13,6 +13,8 @@ import 'package:flutter_gallery/demo/shrine/login.dart'; ...@@ -13,6 +13,8 @@ import 'package:flutter_gallery/demo/shrine/login.dart';
import 'package:flutter_gallery/demo/shrine/supplemental/cut_corners_border.dart'; import 'package:flutter_gallery/demo/shrine/supplemental/cut_corners_border.dart';
class ShrineApp extends StatefulWidget { class ShrineApp extends StatefulWidget {
const ShrineApp({Key? key}) : super(key: key);
@override @override
_ShrineAppState createState() => _ShrineAppState(); _ShrineAppState createState() => _ShrineAppState();
} }
...@@ -62,7 +64,7 @@ Route<dynamic>? _getRoute(RouteSettings settings) { ...@@ -62,7 +64,7 @@ Route<dynamic>? _getRoute(RouteSettings settings) {
return MaterialPageRoute<void>( return MaterialPageRoute<void>(
settings: settings, settings: settings,
builder: (BuildContext context) => LoginPage(), builder: (BuildContext context) => const LoginPage(),
fullscreenDialog: true, fullscreenDialog: true,
); );
} }
......
...@@ -198,12 +198,13 @@ class _BackdropTitle extends AnimatedWidget { ...@@ -198,12 +198,13 @@ class _BackdropTitle extends AnimatedWidget {
/// front or back layer is showing. /// front or back layer is showing.
class Backdrop extends StatefulWidget { class Backdrop extends StatefulWidget {
const Backdrop({ const Backdrop({
Key? key,
required this.frontLayer, required this.frontLayer,
required this.backLayer, required this.backLayer,
required this.frontTitle, required this.frontTitle,
required this.backTitle, required this.backTitle,
required this.controller, required this.controller,
}); }) : super(key: key);
final Widget frontLayer; final Widget frontLayer;
final Widget backLayer; final Widget backLayer;
...@@ -355,7 +356,7 @@ class _BackdropState extends State<Backdrop> with SingleTickerProviderStateMixin ...@@ -355,7 +356,7 @@ class _BackdropState extends State<Backdrop> with SingleTickerProviderStateMixin
onPressed: () { onPressed: () {
Navigator.push<void>( Navigator.push<void>(
context, context,
MaterialPageRoute<void>(builder: (BuildContext context) => LoginPage()), MaterialPageRoute<void>(builder: (BuildContext context) => const LoginPage()),
); );
}, },
), ),
...@@ -364,7 +365,7 @@ class _BackdropState extends State<Backdrop> with SingleTickerProviderStateMixin ...@@ -364,7 +365,7 @@ class _BackdropState extends State<Backdrop> with SingleTickerProviderStateMixin
onPressed: () { onPressed: () {
Navigator.push<void>( Navigator.push<void>(
context, context,
MaterialPageRoute<void>(builder: (BuildContext context) => LoginPage()), MaterialPageRoute<void>(builder: (BuildContext context) => const LoginPage()),
); );
}, },
), ),
......
...@@ -286,9 +286,9 @@ class _ExpandingBottomSheetState extends State<ExpandingBottomSheet> with Ticker ...@@ -286,9 +286,9 @@ class _ExpandingBottomSheetState extends State<ExpandingBottomSheet> with Ticker
width: numProducts > 3 ? _width - 94.0 : _width - 64.0, width: numProducts > 3 ? _width - 94.0 : _width - 64.0,
height: _kCartHeight, height: _kCartHeight,
padding: const EdgeInsets.symmetric(vertical: 8.0), padding: const EdgeInsets.symmetric(vertical: 8.0),
child: ProductThumbnailRow(), child: const ProductThumbnailRow(),
), ),
ExtraProductsNumber(), const ExtraProductsNumber(),
], ],
), ),
], ],
...@@ -300,7 +300,7 @@ class _ExpandingBottomSheetState extends State<ExpandingBottomSheet> with Ticker ...@@ -300,7 +300,7 @@ class _ExpandingBottomSheetState extends State<ExpandingBottomSheet> with Ticker
Widget _buildShoppingCartPage() { Widget _buildShoppingCartPage() {
return Opacity( return Opacity(
opacity: _cartOpacityAnimation.value, opacity: _cartOpacityAnimation.value,
child: ShoppingCartPage(), child: const ShoppingCartPage(),
); );
} }
...@@ -404,6 +404,8 @@ class _ExpandingBottomSheetState extends State<ExpandingBottomSheet> with Ticker ...@@ -404,6 +404,8 @@ class _ExpandingBottomSheetState extends State<ExpandingBottomSheet> with Ticker
} }
class ProductThumbnailRow extends StatefulWidget { class ProductThumbnailRow extends StatefulWidget {
const ProductThumbnailRow({Key? key}) : super(key: key);
@override @override
_ProductThumbnailRowState createState() => _ProductThumbnailRowState(); _ProductThumbnailRowState createState() => _ProductThumbnailRowState();
} }
...@@ -511,6 +513,8 @@ class _ProductThumbnailRowState extends State<ProductThumbnailRow> { ...@@ -511,6 +513,8 @@ class _ProductThumbnailRowState extends State<ProductThumbnailRow> {
} }
class ExtraProductsNumber extends StatelessWidget { class ExtraProductsNumber extends StatelessWidget {
const ExtraProductsNumber({Key? key}) : super(key: key);
// Calculates the number to be displayed at the end of the row if there are // 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, // more than three products in the cart. This calculates overflow products,
// including their duplicates (but not duplicates of products shown as // including their duplicates (but not duplicates of products shown as
...@@ -554,7 +558,7 @@ class ExtraProductsNumber extends StatelessWidget { ...@@ -554,7 +558,7 @@ class ExtraProductsNumber extends StatelessWidget {
} }
class ProductThumbnail extends StatelessWidget { class ProductThumbnail extends StatelessWidget {
const ProductThumbnail(this.animation, this.opacityAnimation, this.product); const ProductThumbnail(this.animation, this.opacityAnimation, this.product, {Key? key}) : super(key: key);
final Animation<double> animation; final Animation<double> animation;
final Animation<double> opacityAnimation; final Animation<double> opacityAnimation;
......
...@@ -12,7 +12,7 @@ import 'package:flutter_gallery/demo/shrine/model/product.dart'; ...@@ -12,7 +12,7 @@ import 'package:flutter_gallery/demo/shrine/model/product.dart';
import 'package:flutter_gallery/demo/shrine/supplemental/asymmetric_view.dart'; import 'package:flutter_gallery/demo/shrine/supplemental/asymmetric_view.dart';
class ProductPage extends StatelessWidget { class ProductPage extends StatelessWidget {
const ProductPage({this.category = Category.all}); const ProductPage({Key? key, this.category = Category.all}) : super(key: key);
final Category category; final Category category;
......
...@@ -7,6 +7,8 @@ import 'package:flutter/material.dart'; ...@@ -7,6 +7,8 @@ import 'package:flutter/material.dart';
import 'package:flutter_gallery/demo/shrine/colors.dart'; import 'package:flutter_gallery/demo/shrine/colors.dart';
class LoginPage extends StatefulWidget { class LoginPage extends StatefulWidget {
const LoginPage({Key? key}) : super(key: key);
@override @override
_LoginPageState createState() => _LoginPageState(); _LoginPageState createState() => _LoginPageState();
} }
......
...@@ -14,6 +14,8 @@ import 'package:flutter_gallery/demo/shrine/model/product.dart'; ...@@ -14,6 +14,8 @@ import 'package:flutter_gallery/demo/shrine/model/product.dart';
const double _leftColumnWidth = 60.0; const double _leftColumnWidth = 60.0;
class ShoppingCartPage extends StatefulWidget { class ShoppingCartPage extends StatefulWidget {
const ShoppingCartPage({Key? key}) : super(key: key);
@override @override
_ShoppingCartPageState createState() => _ShoppingCartPageState(); _ShoppingCartPageState createState() => _ShoppingCartPageState();
} }
...@@ -103,7 +105,7 @@ class _ShoppingCartPageState extends State<ShoppingCartPage> { ...@@ -103,7 +105,7 @@ class _ShoppingCartPageState extends State<ShoppingCartPage> {
} }
class ShoppingCartSummary extends StatelessWidget { class ShoppingCartSummary extends StatelessWidget {
const ShoppingCartSummary({this.model}); const ShoppingCartSummary({Key? key, this.model}) : super(key: key);
final AppStateModel? model; final AppStateModel? model;
...@@ -183,10 +185,11 @@ class ShoppingCartSummary extends StatelessWidget { ...@@ -183,10 +185,11 @@ class ShoppingCartSummary extends StatelessWidget {
class ShoppingCartRow extends StatelessWidget { class ShoppingCartRow extends StatelessWidget {
const ShoppingCartRow({ const ShoppingCartRow({
Key? key,
required this.product, required this.product,
required this.quantity, required this.quantity,
this.onPressed, this.onPressed,
}); }) : super(key: key);
final Product product; final Product product;
final int? quantity; final int? quantity;
......
...@@ -10,8 +10,8 @@ import 'package:flutter_gallery/demo/shrine/model/app_state_model.dart'; ...@@ -10,8 +10,8 @@ import 'package:flutter_gallery/demo/shrine/model/app_state_model.dart';
import 'package:flutter_gallery/demo/shrine/model/product.dart'; import 'package:flutter_gallery/demo/shrine/model/product.dart';
class ProductCard extends StatelessWidget { class ProductCard extends StatelessWidget {
const ProductCard({ this.imageAspectRatio = 33 / 49, this.product }) const ProductCard({ Key? key, this.imageAspectRatio = 33 / 49, this.product })
: assert(imageAspectRatio > 0); : assert(imageAspectRatio > 0), super(key: key);
final double imageAspectRatio; final double imageAspectRatio;
final Product? product; final Product? product;
......
...@@ -9,9 +9,10 @@ import 'package:flutter_gallery/demo/shrine/supplemental/product_card.dart'; ...@@ -9,9 +9,10 @@ import 'package:flutter_gallery/demo/shrine/supplemental/product_card.dart';
class TwoProductCardColumn extends StatelessWidget { class TwoProductCardColumn extends StatelessWidget {
const TwoProductCardColumn({ const TwoProductCardColumn({
Key? key,
required this.bottom, required this.bottom,
this.top, this.top,
}); }) : super(key: key);
final Product? bottom, top; final Product? bottom, top;
...@@ -57,7 +58,7 @@ class TwoProductCardColumn extends StatelessWidget { ...@@ -57,7 +58,7 @@ class TwoProductCardColumn extends StatelessWidget {
} }
class OneProductCardColumn extends StatelessWidget { class OneProductCardColumn extends StatelessWidget {
const OneProductCardColumn({this.product}); const OneProductCardColumn({Key? key, this.product}) : super(key: key);
final Product? product; final Product? product;
......
...@@ -11,5 +11,5 @@ class ShrineDemo extends StatelessWidget { ...@@ -11,5 +11,5 @@ class ShrineDemo extends StatelessWidget {
static const String routeName = '/shrine'; // Used by the Gallery app. static const String routeName = '/shrine'; // Used by the Gallery app.
@override @override
Widget build(BuildContext context) => ShrineApp(); Widget build(BuildContext context) => const ShrineApp();
} }
...@@ -8,10 +8,11 @@ import 'package:flutter/material.dart'; ...@@ -8,10 +8,11 @@ import 'package:flutter/material.dart';
@immutable @immutable
class ColorPicker extends StatelessWidget { class ColorPicker extends StatelessWidget {
const ColorPicker({ const ColorPicker({
Key? key,
required this.colors, required this.colors,
required this.selectedColor, required this.selectedColor,
this.onColorSelection, this.onColorSelection,
}); }) : super(key: key);
final Set<Color> colors; final Set<Color> colors;
final Color selectedColor; final Color selectedColor;
......
...@@ -39,6 +39,8 @@ class TextStyleItem extends StatelessWidget { ...@@ -39,6 +39,8 @@ class TextStyleItem extends StatelessWidget {
} }
class TypographyDemo extends StatelessWidget { class TypographyDemo extends StatelessWidget {
const TypographyDemo({Key? key}) : super(key: key);
static const String routeName = '/typography'; static const String routeName = '/typography';
@override @override
......
...@@ -92,7 +92,7 @@ class VideoCard extends StatelessWidget { ...@@ -92,7 +92,7 @@ class VideoCard extends StatelessWidget {
} }
class VideoPlayerLoading extends StatefulWidget { class VideoPlayerLoading extends StatefulWidget {
const VideoPlayerLoading(this.controller); const VideoPlayerLoading(this.controller, {Key? key}) : super(key: key);
final VideoPlayerController? controller; final VideoPlayerController? controller;
...@@ -136,7 +136,7 @@ class _VideoPlayerLoadingState extends State<VideoPlayerLoading> { ...@@ -136,7 +136,7 @@ class _VideoPlayerLoadingState extends State<VideoPlayerLoading> {
} }
class VideoPlayPause extends StatefulWidget { class VideoPlayPause extends StatefulWidget {
const VideoPlayPause(this.controller); const VideoPlayPause(this.controller, {Key? key}) : super(key: key);
final VideoPlayerController? controller; final VideoPlayerController? controller;
...@@ -202,9 +202,10 @@ class _VideoPlayPauseState extends State<VideoPlayPause> { ...@@ -202,9 +202,10 @@ class _VideoPlayPauseState extends State<VideoPlayPause> {
class FadeAnimation extends StatefulWidget { class FadeAnimation extends StatefulWidget {
const FadeAnimation({ const FadeAnimation({
Key? key,
this.child, this.child,
this.duration = const Duration(milliseconds: 500), this.duration = const Duration(milliseconds: 500),
}); }) : super(key: key);
final Widget? child; final Widget? child;
final Duration duration; final Duration duration;
...@@ -264,9 +265,10 @@ class _FadeAnimationState extends State<FadeAnimation> with SingleTickerProvider ...@@ -264,9 +265,10 @@ class _FadeAnimationState extends State<FadeAnimation> with SingleTickerProvider
class ConnectivityOverlay extends StatefulWidget { class ConnectivityOverlay extends StatefulWidget {
const ConnectivityOverlay({ const ConnectivityOverlay({
Key? key,
this.child, this.child,
this.connectedCompleter, this.connectedCompleter,
}); }) : super(key: key);
final Widget? child; final Widget? child;
final Completer<void>? connectedCompleter; final Completer<void>? connectedCompleter;
......
...@@ -179,13 +179,14 @@ class _BackAppBar extends StatelessWidget { ...@@ -179,13 +179,14 @@ class _BackAppBar extends StatelessWidget {
class Backdrop extends StatefulWidget { class Backdrop extends StatefulWidget {
const Backdrop({ const Backdrop({
Key? key,
this.frontAction, this.frontAction,
this.frontTitle, this.frontTitle,
this.frontHeading, this.frontHeading,
this.frontLayer, this.frontLayer,
this.backTitle, this.backTitle,
this.backLayer, this.backLayer,
}); }) : super(key: key);
final Widget? frontAction; final Widget? frontAction;
final Widget? frontTitle; final Widget? frontTitle;
......
...@@ -42,12 +42,13 @@ class ComponentDemoTabData { ...@@ -42,12 +42,13 @@ class ComponentDemoTabData {
class TabbedComponentDemoScaffold extends StatelessWidget { class TabbedComponentDemoScaffold extends StatelessWidget {
const TabbedComponentDemoScaffold({ const TabbedComponentDemoScaffold({
Key? key,
this.title, this.title,
this.demos, this.demos,
this.actions, this.actions,
this.isScrollable = true, this.isScrollable = true,
this.showExampleCodeAction = true, this.showExampleCodeAction = true,
}); }) : super(key: key);
final List<ComponentDemoTabData>? demos; final List<ComponentDemoTabData>? demos;
final String? title; final String? title;
...@@ -147,7 +148,7 @@ class TabbedComponentDemoScaffold extends StatelessWidget { ...@@ -147,7 +148,7 @@ class TabbedComponentDemoScaffold extends StatelessWidget {
} }
class FullScreenCodeDialog extends StatefulWidget { class FullScreenCodeDialog extends StatefulWidget {
const FullScreenCodeDialog({ this.exampleCodeTag }); const FullScreenCodeDialog({ Key? key, this.exampleCodeTag }) : super(key: key);
final String? exampleCodeTag; final String? exampleCodeTag;
......
...@@ -104,7 +104,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -104,7 +104,7 @@ List<GalleryDemo> _buildGalleryDemos() {
icon: GalleryIcons.custom_typography, icon: GalleryIcons.custom_typography,
category: _kDemos, category: _kDemos,
routeName: FortnightlyDemo.routeName, routeName: FortnightlyDemo.routeName,
buildRoute: (BuildContext context) => FortnightlyDemo(), buildRoute: (BuildContext context) => const FortnightlyDemo(),
), ),
GalleryDemo( GalleryDemo(
title: 'Contact profile', title: 'Contact profile',
...@@ -112,7 +112,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -112,7 +112,7 @@ List<GalleryDemo> _buildGalleryDemos() {
icon: GalleryIcons.account_box, icon: GalleryIcons.account_box,
category: _kDemos, category: _kDemos,
routeName: ContactsDemo.routeName, routeName: ContactsDemo.routeName,
buildRoute: (BuildContext context) => ContactsDemo(), buildRoute: (BuildContext context) => const ContactsDemo(),
), ),
GalleryDemo( GalleryDemo(
title: 'Animation', title: 'Animation',
...@@ -146,7 +146,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -146,7 +146,7 @@ List<GalleryDemo> _buildGalleryDemos() {
icon: GalleryIcons.colors, icon: GalleryIcons.colors,
category: _kStyle, category: _kStyle,
routeName: ColorsDemo.routeName, routeName: ColorsDemo.routeName,
buildRoute: (BuildContext context) => ColorsDemo(), buildRoute: (BuildContext context) => const ColorsDemo(),
), ),
GalleryDemo( GalleryDemo(
title: 'Typography', title: 'Typography',
...@@ -154,7 +154,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -154,7 +154,7 @@ List<GalleryDemo> _buildGalleryDemos() {
icon: GalleryIcons.custom_typography, icon: GalleryIcons.custom_typography,
category: _kStyle, category: _kStyle,
routeName: TypographyDemo.routeName, routeName: TypographyDemo.routeName,
buildRoute: (BuildContext context) => TypographyDemo(), buildRoute: (BuildContext context) => const TypographyDemo(),
), ),
// Material Components // Material Components
...@@ -164,7 +164,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -164,7 +164,7 @@ List<GalleryDemo> _buildGalleryDemos() {
icon: GalleryIcons.backdrop, icon: GalleryIcons.backdrop,
category: _kMaterialComponents, category: _kMaterialComponents,
routeName: BackdropDemo.routeName, routeName: BackdropDemo.routeName,
buildRoute: (BuildContext context) => BackdropDemo(), buildRoute: (BuildContext context) => const BackdropDemo(),
), ),
GalleryDemo( GalleryDemo(
title: 'Banner', title: 'Banner',
...@@ -182,7 +182,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -182,7 +182,7 @@ List<GalleryDemo> _buildGalleryDemos() {
category: _kMaterialComponents, category: _kMaterialComponents,
routeName: BottomAppBarDemo.routeName, routeName: BottomAppBarDemo.routeName,
documentationUrl: 'https://api.flutter.dev/flutter/material/BottomAppBar-class.html', documentationUrl: 'https://api.flutter.dev/flutter/material/BottomAppBar-class.html',
buildRoute: (BuildContext context) => BottomAppBarDemo(), buildRoute: (BuildContext context) => const BottomAppBarDemo(),
), ),
GalleryDemo( GalleryDemo(
title: 'Bottom navigation', title: 'Bottom navigation',
...@@ -191,7 +191,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -191,7 +191,7 @@ List<GalleryDemo> _buildGalleryDemos() {
category: _kMaterialComponents, category: _kMaterialComponents,
routeName: BottomNavigationDemo.routeName, routeName: BottomNavigationDemo.routeName,
documentationUrl: 'https://api.flutter.dev/flutter/material/BottomNavigationBar-class.html', documentationUrl: 'https://api.flutter.dev/flutter/material/BottomNavigationBar-class.html',
buildRoute: (BuildContext context) => BottomNavigationDemo(), buildRoute: (BuildContext context) => const BottomNavigationDemo(),
), ),
GalleryDemo( GalleryDemo(
title: 'Bottom sheet: Modal', title: 'Bottom sheet: Modal',
...@@ -200,7 +200,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -200,7 +200,7 @@ List<GalleryDemo> _buildGalleryDemos() {
category: _kMaterialComponents, category: _kMaterialComponents,
routeName: ModalBottomSheetDemo.routeName, routeName: ModalBottomSheetDemo.routeName,
documentationUrl: 'https://api.flutter.dev/flutter/material/showModalBottomSheet.html', documentationUrl: 'https://api.flutter.dev/flutter/material/showModalBottomSheet.html',
buildRoute: (BuildContext context) => ModalBottomSheetDemo(), buildRoute: (BuildContext context) => const ModalBottomSheetDemo(),
), ),
GalleryDemo( GalleryDemo(
title: 'Bottom sheet: Persistent', title: 'Bottom sheet: Persistent',
...@@ -209,7 +209,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -209,7 +209,7 @@ List<GalleryDemo> _buildGalleryDemos() {
category: _kMaterialComponents, category: _kMaterialComponents,
routeName: PersistentBottomSheetDemo.routeName, routeName: PersistentBottomSheetDemo.routeName,
documentationUrl: 'https://api.flutter.dev/flutter/material/ScaffoldState/showBottomSheet.html', documentationUrl: 'https://api.flutter.dev/flutter/material/ScaffoldState/showBottomSheet.html',
buildRoute: (BuildContext context) => PersistentBottomSheetDemo(), buildRoute: (BuildContext context) => const PersistentBottomSheetDemo(),
), ),
GalleryDemo( GalleryDemo(
title: 'Buttons', title: 'Buttons',
...@@ -217,7 +217,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -217,7 +217,7 @@ List<GalleryDemo> _buildGalleryDemos() {
icon: GalleryIcons.generic_buttons, icon: GalleryIcons.generic_buttons,
category: _kMaterialComponents, category: _kMaterialComponents,
routeName: ButtonsDemo.routeName, routeName: ButtonsDemo.routeName,
buildRoute: (BuildContext context) => ButtonsDemo(), buildRoute: (BuildContext context) => const ButtonsDemo(),
), ),
GalleryDemo( GalleryDemo(
title: 'Buttons: Floating Action Button', title: 'Buttons: Floating Action Button',
...@@ -226,7 +226,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -226,7 +226,7 @@ List<GalleryDemo> _buildGalleryDemos() {
category: _kMaterialComponents, category: _kMaterialComponents,
routeName: TabsFabDemo.routeName, routeName: TabsFabDemo.routeName,
documentationUrl: 'https://api.flutter.dev/flutter/material/FloatingActionButton-class.html', documentationUrl: 'https://api.flutter.dev/flutter/material/FloatingActionButton-class.html',
buildRoute: (BuildContext context) => TabsFabDemo(), buildRoute: (BuildContext context) => const TabsFabDemo(),
), ),
GalleryDemo( GalleryDemo(
title: 'Cards', title: 'Cards',
...@@ -235,7 +235,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -235,7 +235,7 @@ List<GalleryDemo> _buildGalleryDemos() {
category: _kMaterialComponents, category: _kMaterialComponents,
routeName: CardsDemo.routeName, routeName: CardsDemo.routeName,
documentationUrl: 'https://api.flutter.dev/flutter/material/Card-class.html', documentationUrl: 'https://api.flutter.dev/flutter/material/Card-class.html',
buildRoute: (BuildContext context) => CardsDemo(), buildRoute: (BuildContext context) => const CardsDemo(),
), ),
GalleryDemo( GalleryDemo(
title: 'Chips', title: 'Chips',
...@@ -244,7 +244,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -244,7 +244,7 @@ List<GalleryDemo> _buildGalleryDemos() {
category: _kMaterialComponents, category: _kMaterialComponents,
routeName: ChipDemo.routeName, routeName: ChipDemo.routeName,
documentationUrl: 'https://api.flutter.dev/flutter/material/Chip-class.html', documentationUrl: 'https://api.flutter.dev/flutter/material/Chip-class.html',
buildRoute: (BuildContext context) => ChipDemo(), buildRoute: (BuildContext context) => const ChipDemo(),
), ),
GalleryDemo( GalleryDemo(
title: 'Data tables', title: 'Data tables',
...@@ -253,7 +253,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -253,7 +253,7 @@ List<GalleryDemo> _buildGalleryDemos() {
category: _kMaterialComponents, category: _kMaterialComponents,
routeName: DataTableDemo.routeName, routeName: DataTableDemo.routeName,
documentationUrl: 'https://api.flutter.dev/flutter/material/PaginatedDataTable-class.html', documentationUrl: 'https://api.flutter.dev/flutter/material/PaginatedDataTable-class.html',
buildRoute: (BuildContext context) => DataTableDemo(), buildRoute: (BuildContext context) => const DataTableDemo(),
), ),
GalleryDemo( GalleryDemo(
title: 'Dialogs', title: 'Dialogs',
...@@ -262,7 +262,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -262,7 +262,7 @@ List<GalleryDemo> _buildGalleryDemos() {
category: _kMaterialComponents, category: _kMaterialComponents,
routeName: DialogDemo.routeName, routeName: DialogDemo.routeName,
documentationUrl: 'https://api.flutter.dev/flutter/material/showDialog.html', documentationUrl: 'https://api.flutter.dev/flutter/material/showDialog.html',
buildRoute: (BuildContext context) => DialogDemo(), buildRoute: (BuildContext context) => const DialogDemo(),
), ),
GalleryDemo( GalleryDemo(
title: 'Elevations', title: 'Elevations',
...@@ -272,7 +272,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -272,7 +272,7 @@ List<GalleryDemo> _buildGalleryDemos() {
category: _kMaterialComponents, category: _kMaterialComponents,
routeName: ElevationDemo.routeName, routeName: ElevationDemo.routeName,
documentationUrl: 'https://api.flutter.dev/flutter/material/Material/elevation.html', documentationUrl: 'https://api.flutter.dev/flutter/material/Material/elevation.html',
buildRoute: (BuildContext context) => ElevationDemo(), buildRoute: (BuildContext context) => const ElevationDemo(),
), ),
GalleryDemo( GalleryDemo(
title: 'Expand/collapse list control', title: 'Expand/collapse list control',
...@@ -281,7 +281,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -281,7 +281,7 @@ List<GalleryDemo> _buildGalleryDemos() {
category: _kMaterialComponents, category: _kMaterialComponents,
routeName: ExpansionTileListDemo.routeName, routeName: ExpansionTileListDemo.routeName,
documentationUrl: 'https://api.flutter.dev/flutter/material/ExpansionTile-class.html', documentationUrl: 'https://api.flutter.dev/flutter/material/ExpansionTile-class.html',
buildRoute: (BuildContext context) => ExpansionTileListDemo(), buildRoute: (BuildContext context) => const ExpansionTileListDemo(),
), ),
GalleryDemo( GalleryDemo(
title: 'Expansion panels', title: 'Expansion panels',
...@@ -290,7 +290,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -290,7 +290,7 @@ List<GalleryDemo> _buildGalleryDemos() {
category: _kMaterialComponents, category: _kMaterialComponents,
routeName: ExpansionPanelsDemo.routeName, routeName: ExpansionPanelsDemo.routeName,
documentationUrl: 'https://api.flutter.dev/flutter/material/ExpansionPanel-class.html', documentationUrl: 'https://api.flutter.dev/flutter/material/ExpansionPanel-class.html',
buildRoute: (BuildContext context) => ExpansionPanelsDemo(), buildRoute: (BuildContext context) => const ExpansionPanelsDemo(),
), ),
GalleryDemo( GalleryDemo(
title: 'Grid', title: 'Grid',
...@@ -308,7 +308,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -308,7 +308,7 @@ List<GalleryDemo> _buildGalleryDemos() {
category: _kMaterialComponents, category: _kMaterialComponents,
routeName: IconsDemo.routeName, routeName: IconsDemo.routeName,
documentationUrl: 'https://api.flutter.dev/flutter/material/IconButton-class.html', documentationUrl: 'https://api.flutter.dev/flutter/material/IconButton-class.html',
buildRoute: (BuildContext context) => IconsDemo(), buildRoute: (BuildContext context) => const IconsDemo(),
), ),
GalleryDemo( GalleryDemo(
title: 'Lists', title: 'Lists',
...@@ -353,7 +353,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -353,7 +353,7 @@ List<GalleryDemo> _buildGalleryDemos() {
category: _kMaterialComponents, category: _kMaterialComponents,
routeName: DrawerDemo.routeName, routeName: DrawerDemo.routeName,
documentationUrl: 'https://api.flutter.dev/flutter/material/Drawer-class.html', documentationUrl: 'https://api.flutter.dev/flutter/material/Drawer-class.html',
buildRoute: (BuildContext context) => DrawerDemo(), buildRoute: (BuildContext context) => const DrawerDemo(),
), ),
GalleryDemo( GalleryDemo(
title: 'Pagination', title: 'Pagination',
...@@ -362,7 +362,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -362,7 +362,7 @@ List<GalleryDemo> _buildGalleryDemos() {
category: _kMaterialComponents, category: _kMaterialComponents,
routeName: PageSelectorDemo.routeName, routeName: PageSelectorDemo.routeName,
documentationUrl: 'https://api.flutter.dev/flutter/material/TabBarView-class.html', documentationUrl: 'https://api.flutter.dev/flutter/material/TabBarView-class.html',
buildRoute: (BuildContext context) => PageSelectorDemo(), buildRoute: (BuildContext context) => const PageSelectorDemo(),
), ),
GalleryDemo( GalleryDemo(
title: 'Pickers', title: 'Pickers',
...@@ -371,7 +371,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -371,7 +371,7 @@ List<GalleryDemo> _buildGalleryDemos() {
category: _kMaterialComponents, category: _kMaterialComponents,
routeName: DateAndTimePickerDemo.routeName, routeName: DateAndTimePickerDemo.routeName,
documentationUrl: 'https://api.flutter.dev/flutter/material/showDatePicker.html', documentationUrl: 'https://api.flutter.dev/flutter/material/showDatePicker.html',
buildRoute: (BuildContext context) => DateAndTimePickerDemo(), buildRoute: (BuildContext context) => const DateAndTimePickerDemo(),
), ),
GalleryDemo( GalleryDemo(
title: 'Progress indicators', title: 'Progress indicators',
...@@ -380,7 +380,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -380,7 +380,7 @@ List<GalleryDemo> _buildGalleryDemos() {
category: _kMaterialComponents, category: _kMaterialComponents,
routeName: ProgressIndicatorDemo.routeName, routeName: ProgressIndicatorDemo.routeName,
documentationUrl: 'https://api.flutter.dev/flutter/material/LinearProgressIndicator-class.html', documentationUrl: 'https://api.flutter.dev/flutter/material/LinearProgressIndicator-class.html',
buildRoute: (BuildContext context) => ProgressIndicatorDemo(), buildRoute: (BuildContext context) => const ProgressIndicatorDemo(),
), ),
GalleryDemo( GalleryDemo(
title: 'Pull to refresh', title: 'Pull to refresh',
...@@ -398,7 +398,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -398,7 +398,7 @@ List<GalleryDemo> _buildGalleryDemos() {
category: _kMaterialComponents, category: _kMaterialComponents,
routeName: SearchDemo.routeName, routeName: SearchDemo.routeName,
documentationUrl: 'https://api.flutter.dev/flutter/material/showSearch.html', documentationUrl: 'https://api.flutter.dev/flutter/material/showSearch.html',
buildRoute: (BuildContext context) => SearchDemo(), buildRoute: (BuildContext context) => const SearchDemo(),
), ),
GalleryDemo( GalleryDemo(
title: 'Selection controls', title: 'Selection controls',
...@@ -406,7 +406,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -406,7 +406,7 @@ List<GalleryDemo> _buildGalleryDemos() {
icon: GalleryIcons.check_box, icon: GalleryIcons.check_box,
category: _kMaterialComponents, category: _kMaterialComponents,
routeName: SelectionControlsDemo.routeName, routeName: SelectionControlsDemo.routeName,
buildRoute: (BuildContext context) => SelectionControlsDemo(), buildRoute: (BuildContext context) => const SelectionControlsDemo(),
), ),
GalleryDemo( GalleryDemo(
title: 'Sliders', title: 'Sliders',
...@@ -415,7 +415,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -415,7 +415,7 @@ List<GalleryDemo> _buildGalleryDemos() {
category: _kMaterialComponents, category: _kMaterialComponents,
routeName: SliderDemo.routeName, routeName: SliderDemo.routeName,
documentationUrl: 'https://api.flutter.dev/flutter/material/Slider-class.html', documentationUrl: 'https://api.flutter.dev/flutter/material/Slider-class.html',
buildRoute: (BuildContext context) => SliderDemo(), buildRoute: (BuildContext context) => const SliderDemo(),
), ),
GalleryDemo( GalleryDemo(
title: 'Snackbar', title: 'Snackbar',
...@@ -433,7 +433,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -433,7 +433,7 @@ List<GalleryDemo> _buildGalleryDemos() {
category: _kMaterialComponents, category: _kMaterialComponents,
routeName: TabsDemo.routeName, routeName: TabsDemo.routeName,
documentationUrl: 'https://api.flutter.dev/flutter/material/TabBarView-class.html', documentationUrl: 'https://api.flutter.dev/flutter/material/TabBarView-class.html',
buildRoute: (BuildContext context) => TabsDemo(), buildRoute: (BuildContext context) => const TabsDemo(),
), ),
GalleryDemo( GalleryDemo(
title: 'Tabs: Scrolling', title: 'Tabs: Scrolling',
...@@ -442,7 +442,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -442,7 +442,7 @@ List<GalleryDemo> _buildGalleryDemos() {
icon: GalleryIcons.tabs, icon: GalleryIcons.tabs,
routeName: ScrollableTabsDemo.routeName, routeName: ScrollableTabsDemo.routeName,
documentationUrl: 'https://api.flutter.dev/flutter/material/TabBar-class.html', documentationUrl: 'https://api.flutter.dev/flutter/material/TabBar-class.html',
buildRoute: (BuildContext context) => ScrollableTabsDemo(), buildRoute: (BuildContext context) => const ScrollableTabsDemo(),
), ),
GalleryDemo( GalleryDemo(
title: 'Text fields', title: 'Text fields',
...@@ -460,7 +460,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -460,7 +460,7 @@ List<GalleryDemo> _buildGalleryDemos() {
category: _kMaterialComponents, category: _kMaterialComponents,
routeName: TooltipDemo.routeName, routeName: TooltipDemo.routeName,
documentationUrl: 'https://api.flutter.dev/flutter/material/Tooltip-class.html', documentationUrl: 'https://api.flutter.dev/flutter/material/Tooltip-class.html',
buildRoute: (BuildContext context) => TooltipDemo(), buildRoute: (BuildContext context) => const TooltipDemo(),
), ),
// Cupertino Components // Cupertino Components
...@@ -470,7 +470,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -470,7 +470,7 @@ List<GalleryDemo> _buildGalleryDemos() {
category: _kCupertinoComponents, category: _kCupertinoComponents,
routeName: CupertinoProgressIndicatorDemo.routeName, routeName: CupertinoProgressIndicatorDemo.routeName,
documentationUrl: 'https://api.flutter.dev/flutter/cupertino/CupertinoActivityIndicator-class.html', documentationUrl: 'https://api.flutter.dev/flutter/cupertino/CupertinoActivityIndicator-class.html',
buildRoute: (BuildContext context) => CupertinoProgressIndicatorDemo(), buildRoute: (BuildContext context) => const CupertinoProgressIndicatorDemo(),
), ),
GalleryDemo( GalleryDemo(
title: 'Alerts', title: 'Alerts',
...@@ -478,7 +478,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -478,7 +478,7 @@ List<GalleryDemo> _buildGalleryDemos() {
category: _kCupertinoComponents, category: _kCupertinoComponents,
routeName: CupertinoAlertDemo.routeName, routeName: CupertinoAlertDemo.routeName,
documentationUrl: 'https://api.flutter.dev/flutter/cupertino/showCupertinoDialog.html', documentationUrl: 'https://api.flutter.dev/flutter/cupertino/showCupertinoDialog.html',
buildRoute: (BuildContext context) => CupertinoAlertDemo(), buildRoute: (BuildContext context) => const CupertinoAlertDemo(),
), ),
GalleryDemo( GalleryDemo(
title: 'Buttons', title: 'Buttons',
...@@ -486,7 +486,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -486,7 +486,7 @@ List<GalleryDemo> _buildGalleryDemos() {
category: _kCupertinoComponents, category: _kCupertinoComponents,
routeName: CupertinoButtonsDemo.routeName, routeName: CupertinoButtonsDemo.routeName,
documentationUrl: 'https://api.flutter.dev/flutter/cupertino/CupertinoButton-class.html', documentationUrl: 'https://api.flutter.dev/flutter/cupertino/CupertinoButton-class.html',
buildRoute: (BuildContext context) => CupertinoButtonsDemo(), buildRoute: (BuildContext context) => const CupertinoButtonsDemo(),
), ),
GalleryDemo( GalleryDemo(
title: 'Navigation', title: 'Navigation',
...@@ -502,7 +502,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -502,7 +502,7 @@ List<GalleryDemo> _buildGalleryDemos() {
category: _kCupertinoComponents, category: _kCupertinoComponents,
routeName: CupertinoPickerDemo.routeName, routeName: CupertinoPickerDemo.routeName,
documentationUrl: 'https://api.flutter.dev/flutter/cupertino/CupertinoPicker-class.html', documentationUrl: 'https://api.flutter.dev/flutter/cupertino/CupertinoPicker-class.html',
buildRoute: (BuildContext context) => CupertinoPickerDemo(), buildRoute: (BuildContext context) => const CupertinoPickerDemo(),
), ),
GalleryDemo( GalleryDemo(
title: 'Pull to refresh', title: 'Pull to refresh',
...@@ -510,7 +510,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -510,7 +510,7 @@ List<GalleryDemo> _buildGalleryDemos() {
category: _kCupertinoComponents, category: _kCupertinoComponents,
routeName: CupertinoRefreshControlDemo.routeName, routeName: CupertinoRefreshControlDemo.routeName,
documentationUrl: 'https://api.flutter.dev/flutter/cupertino/CupertinoSliverRefreshControl-class.html', documentationUrl: 'https://api.flutter.dev/flutter/cupertino/CupertinoSliverRefreshControl-class.html',
buildRoute: (BuildContext context) => CupertinoRefreshControlDemo(), buildRoute: (BuildContext context) => const CupertinoRefreshControlDemo(),
), ),
GalleryDemo( GalleryDemo(
title: 'Segmented Control', title: 'Segmented Control',
...@@ -518,7 +518,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -518,7 +518,7 @@ List<GalleryDemo> _buildGalleryDemos() {
category: _kCupertinoComponents, category: _kCupertinoComponents,
routeName: CupertinoSegmentedControlDemo.routeName, routeName: CupertinoSegmentedControlDemo.routeName,
documentationUrl: 'https://api.flutter.dev/flutter/cupertino/CupertinoSegmentedControl-class.html', documentationUrl: 'https://api.flutter.dev/flutter/cupertino/CupertinoSegmentedControl-class.html',
buildRoute: (BuildContext context) => CupertinoSegmentedControlDemo(), buildRoute: (BuildContext context) => const CupertinoSegmentedControlDemo(),
), ),
GalleryDemo( GalleryDemo(
title: 'Sliders', title: 'Sliders',
...@@ -526,7 +526,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -526,7 +526,7 @@ List<GalleryDemo> _buildGalleryDemos() {
category: _kCupertinoComponents, category: _kCupertinoComponents,
routeName: CupertinoSliderDemo.routeName, routeName: CupertinoSliderDemo.routeName,
documentationUrl: 'https://api.flutter.dev/flutter/cupertino/CupertinoSlider-class.html', documentationUrl: 'https://api.flutter.dev/flutter/cupertino/CupertinoSlider-class.html',
buildRoute: (BuildContext context) => CupertinoSliderDemo(), buildRoute: (BuildContext context) => const CupertinoSliderDemo(),
), ),
GalleryDemo( GalleryDemo(
title: 'Switches', title: 'Switches',
...@@ -534,14 +534,14 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -534,14 +534,14 @@ List<GalleryDemo> _buildGalleryDemos() {
category: _kCupertinoComponents, category: _kCupertinoComponents,
routeName: CupertinoSwitchDemo.routeName, routeName: CupertinoSwitchDemo.routeName,
documentationUrl: 'https://api.flutter.dev/flutter/cupertino/CupertinoSwitch-class.html', documentationUrl: 'https://api.flutter.dev/flutter/cupertino/CupertinoSwitch-class.html',
buildRoute: (BuildContext context) => CupertinoSwitchDemo(), buildRoute: (BuildContext context) => const CupertinoSwitchDemo(),
), ),
GalleryDemo( GalleryDemo(
title: 'Text Fields', title: 'Text Fields',
icon: GalleryIcons.text_fields_alt, icon: GalleryIcons.text_fields_alt,
category: _kCupertinoComponents, category: _kCupertinoComponents,
routeName: CupertinoTextFieldDemo.routeName, routeName: CupertinoTextFieldDemo.routeName,
buildRoute: (BuildContext context) => CupertinoTextFieldDemo(), buildRoute: (BuildContext context) => const CupertinoTextFieldDemo(),
), ),
// Media // Media
...@@ -551,7 +551,7 @@ List<GalleryDemo> _buildGalleryDemos() { ...@@ -551,7 +551,7 @@ List<GalleryDemo> _buildGalleryDemos() {
icon: GalleryIcons.animation, icon: GalleryIcons.animation,
category: _kMedia, category: _kMedia,
routeName: ImagesDemo.routeName, routeName: ImagesDemo.routeName,
buildRoute: (BuildContext context) => ImagesDemo(), buildRoute: (BuildContext context) => const ImagesDemo(),
), ),
GalleryDemo( GalleryDemo(
title: 'Video', title: 'Video',
......
...@@ -12,84 +12,84 @@ void main() { ...@@ -12,84 +12,84 @@ void main() {
group('All material demos meet recommended tap target sizes', () { group('All material demos meet recommended tap target sizes', () {
testWidgets('backdrop_demo', (WidgetTester tester) async { testWidgets('backdrop_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(home: BackdropDemo())); await tester.pumpWidget(const MaterialApp(home: BackdropDemo()));
await expectLater(tester, meetsGuideline(androidTapTargetGuideline)); await expectLater(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose(); handle.dispose();
}); });
testWidgets('bottom_app_bar_demo', (WidgetTester tester) async { testWidgets('bottom_app_bar_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(home: BottomAppBarDemo())); await tester.pumpWidget(const MaterialApp(home: BottomAppBarDemo()));
await expectLater(tester, meetsGuideline(androidTapTargetGuideline)); await expectLater(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose(); handle.dispose();
}); });
testWidgets('bottom_navigation_demo', (WidgetTester tester) async { testWidgets('bottom_navigation_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(home: BottomNavigationDemo())); await tester.pumpWidget(const MaterialApp(home: BottomNavigationDemo()));
await expectLater(tester, meetsGuideline(androidTapTargetGuideline)); await expectLater(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose(); handle.dispose();
}); });
testWidgets('buttons_demo', (WidgetTester tester) async { testWidgets('buttons_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(home: ButtonsDemo())); await tester.pumpWidget(const MaterialApp(home: ButtonsDemo()));
await expectLater(tester, meetsGuideline(androidTapTargetGuideline)); await expectLater(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose(); handle.dispose();
}); });
testWidgets('cards_demo', (WidgetTester tester) async { testWidgets('cards_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(home: CardsDemo())); await tester.pumpWidget(const MaterialApp(home: CardsDemo()));
await expectLater(tester, meetsGuideline(androidTapTargetGuideline)); await expectLater(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose(); handle.dispose();
}); });
testWidgets('chip_demo', (WidgetTester tester) async { testWidgets('chip_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(home: ChipDemo())); await tester.pumpWidget(const MaterialApp(home: ChipDemo()));
await expectLater(tester, meetsGuideline(androidTapTargetGuideline)); await expectLater(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose(); handle.dispose();
}, skip: true); // https://github.com/flutter/flutter/issues/42455 }, skip: true); // https://github.com/flutter/flutter/issues/42455
testWidgets('data_table_demo', (WidgetTester tester) async { testWidgets('data_table_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(home: DataTableDemo())); await tester.pumpWidget(const MaterialApp(home: DataTableDemo()));
await expectLater(tester, meetsGuideline(androidTapTargetGuideline)); await expectLater(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose(); handle.dispose();
}); });
testWidgets('date_and_time_picker_demo', (WidgetTester tester) async { testWidgets('date_and_time_picker_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(home: DateAndTimePickerDemo())); await tester.pumpWidget(const MaterialApp(home: DateAndTimePickerDemo()));
await expectLater(tester, meetsGuideline(androidTapTargetGuideline)); await expectLater(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose(); handle.dispose();
}); });
testWidgets('dialog_demo', (WidgetTester tester) async { testWidgets('dialog_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(home: DialogDemo())); await tester.pumpWidget(const MaterialApp(home: DialogDemo()));
await expectLater(tester, meetsGuideline(androidTapTargetGuideline)); await expectLater(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose(); handle.dispose();
}); });
testWidgets('drawer_demo', (WidgetTester tester) async { testWidgets('drawer_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(home: DrawerDemo())); await tester.pumpWidget(const MaterialApp(home: DrawerDemo()));
await expectLater(tester, meetsGuideline(androidTapTargetGuideline)); await expectLater(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose(); handle.dispose();
}); });
testWidgets('elevation_demo', (WidgetTester tester) async { testWidgets('elevation_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(home: ElevationDemo())); await tester.pumpWidget(const MaterialApp(home: ElevationDemo()));
await expectLater(tester, meetsGuideline(androidTapTargetGuideline)); await expectLater(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose(); handle.dispose();
}); });
testWidgets('expansion_panels_demo', (WidgetTester tester) async { testWidgets('expansion_panels_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(home: ExpansionPanelsDemo())); await tester.pumpWidget(const MaterialApp(home: ExpansionPanelsDemo()));
await expectLater(tester, meetsGuideline(androidTapTargetGuideline)); await expectLater(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose(); handle.dispose();
}); });
...@@ -103,7 +103,7 @@ void main() { ...@@ -103,7 +103,7 @@ void main() {
testWidgets('icons_demo', (WidgetTester tester) async { testWidgets('icons_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(home: IconsDemo())); await tester.pumpWidget(const MaterialApp(home: IconsDemo()));
await expectLater(tester, meetsGuideline(androidTapTargetGuideline)); await expectLater(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose(); handle.dispose();
}); });
...@@ -131,7 +131,7 @@ void main() { ...@@ -131,7 +131,7 @@ void main() {
testWidgets('modal_bottom_sheet_demo', (WidgetTester tester) async { testWidgets('modal_bottom_sheet_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(home: ModalBottomSheetDemo())); await tester.pumpWidget(const MaterialApp(home: ModalBottomSheetDemo()));
await expectLater(tester, meetsGuideline(androidTapTargetGuideline)); await expectLater(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose(); handle.dispose();
}); });
...@@ -145,21 +145,21 @@ void main() { ...@@ -145,21 +145,21 @@ void main() {
testWidgets('page_selector_demo', (WidgetTester tester) async { testWidgets('page_selector_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(home: PageSelectorDemo())); await tester.pumpWidget(const MaterialApp(home: PageSelectorDemo()));
await expectLater(tester, meetsGuideline(androidTapTargetGuideline)); await expectLater(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose(); handle.dispose();
}); });
testWidgets('persistent_bottom_sheet_demo', (WidgetTester tester) async { testWidgets('persistent_bottom_sheet_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(home: PersistentBottomSheetDemo())); await tester.pumpWidget(const MaterialApp(home: PersistentBottomSheetDemo()));
await expectLater(tester, meetsGuideline(androidTapTargetGuideline)); await expectLater(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose(); handle.dispose();
}); });
testWidgets('progress_indicator_demo', (WidgetTester tester) async { testWidgets('progress_indicator_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(home: ProgressIndicatorDemo())); await tester.pumpWidget(const MaterialApp(home: ProgressIndicatorDemo()));
await expectLater(tester, meetsGuideline(androidTapTargetGuideline)); await expectLater(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose(); handle.dispose();
}); });
...@@ -173,28 +173,28 @@ void main() { ...@@ -173,28 +173,28 @@ void main() {
testWidgets('scrollable_tabs_demo', (WidgetTester tester) async { testWidgets('scrollable_tabs_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(home: ScrollableTabsDemo())); await tester.pumpWidget(const MaterialApp(home: ScrollableTabsDemo()));
await expectLater(tester, meetsGuideline(androidTapTargetGuideline)); await expectLater(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose(); handle.dispose();
}); });
testWidgets('search_demo', (WidgetTester tester) async { testWidgets('search_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(home: SearchDemo())); await tester.pumpWidget(const MaterialApp(home: SearchDemo()));
await expectLater(tester, meetsGuideline(androidTapTargetGuideline)); await expectLater(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose(); handle.dispose();
}); });
testWidgets('selection_controls_demo', (WidgetTester tester) async { testWidgets('selection_controls_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(home: SelectionControlsDemo())); await tester.pumpWidget(const MaterialApp(home: SelectionControlsDemo()));
await expectLater(tester, meetsGuideline(androidTapTargetGuideline)); await expectLater(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose(); handle.dispose();
}); });
testWidgets('slider_demo', (WidgetTester tester) async { testWidgets('slider_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(home: SliderDemo())); await tester.pumpWidget(const MaterialApp(home: SliderDemo()));
await expectLater(tester, meetsGuideline(androidTapTargetGuideline)); await expectLater(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose(); handle.dispose();
}); });
...@@ -208,14 +208,14 @@ void main() { ...@@ -208,14 +208,14 @@ void main() {
testWidgets('tabs_demo', (WidgetTester tester) async { testWidgets('tabs_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(home: TabsDemo())); await tester.pumpWidget(const MaterialApp(home: TabsDemo()));
await expectLater(tester, meetsGuideline(androidTapTargetGuideline)); await expectLater(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose(); handle.dispose();
}); });
testWidgets('tabs_fab_demo', (WidgetTester tester) async { testWidgets('tabs_fab_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(home: TabsFabDemo())); await tester.pumpWidget(const MaterialApp(home: TabsFabDemo()));
await expectLater(tester, meetsGuideline(androidTapTargetGuideline)); await expectLater(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose(); handle.dispose();
}); });
...@@ -229,14 +229,14 @@ void main() { ...@@ -229,14 +229,14 @@ void main() {
testWidgets('tooltip_demo', (WidgetTester tester) async { testWidgets('tooltip_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(home: TooltipDemo())); await tester.pumpWidget(const MaterialApp(home: TooltipDemo()));
await expectLater(tester, meetsGuideline(androidTapTargetGuideline)); await expectLater(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose(); handle.dispose();
}); });
testWidgets('expansion_tile_list_demo', (WidgetTester tester) async { testWidgets('expansion_tile_list_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(home: ExpansionTileListDemo())); await tester.pumpWidget(const MaterialApp(home: ExpansionTileListDemo()));
await expectLater(tester, meetsGuideline(androidTapTargetGuideline)); await expectLater(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose(); handle.dispose();
}); });
...@@ -245,84 +245,84 @@ void main() { ...@@ -245,84 +245,84 @@ void main() {
group('All material demos have labeled tap targets', () { group('All material demos have labeled tap targets', () {
testWidgets('backdrop_demo', (WidgetTester tester) async { testWidgets('backdrop_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(home: BackdropDemo())); await tester.pumpWidget(const MaterialApp(home: BackdropDemo()));
await expectLater(tester, meetsGuideline(labeledTapTargetGuideline)); await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
handle.dispose(); handle.dispose();
}); });
testWidgets('bottom_app_bar_demo', (WidgetTester tester) async { testWidgets('bottom_app_bar_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(home: BottomAppBarDemo())); await tester.pumpWidget(const MaterialApp(home: BottomAppBarDemo()));
await expectLater(tester, meetsGuideline(labeledTapTargetGuideline)); await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
handle.dispose(); handle.dispose();
}); });
testWidgets('bottom_navigation_demo', (WidgetTester tester) async { testWidgets('bottom_navigation_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(home: BottomNavigationDemo())); await tester.pumpWidget(const MaterialApp(home: BottomNavigationDemo()));
await expectLater(tester, meetsGuideline(labeledTapTargetGuideline)); await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
handle.dispose(); handle.dispose();
}); });
testWidgets('buttons_demo', (WidgetTester tester) async { testWidgets('buttons_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(home: ButtonsDemo())); await tester.pumpWidget(const MaterialApp(home: ButtonsDemo()));
await expectLater(tester, meetsGuideline(labeledTapTargetGuideline)); await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
handle.dispose(); handle.dispose();
}); });
testWidgets('cards_demo', (WidgetTester tester) async { testWidgets('cards_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(home: CardsDemo())); await tester.pumpWidget(const MaterialApp(home: CardsDemo()));
await expectLater(tester, meetsGuideline(labeledTapTargetGuideline)); await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
handle.dispose(); handle.dispose();
}); });
testWidgets('chip_demo', (WidgetTester tester) async { testWidgets('chip_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(home: ChipDemo())); await tester.pumpWidget(const MaterialApp(home: ChipDemo()));
await expectLater(tester, meetsGuideline(labeledTapTargetGuideline)); await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
handle.dispose(); handle.dispose();
}); });
testWidgets('data_table_demo', (WidgetTester tester) async { testWidgets('data_table_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(home: DataTableDemo())); await tester.pumpWidget(const MaterialApp(home: DataTableDemo()));
await expectLater(tester, meetsGuideline(labeledTapTargetGuideline)); await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
handle.dispose(); handle.dispose();
}, skip: true); // DataTables are not accessible, https://github.com/flutter/flutter/issues/10830 }, skip: true); // DataTables are not accessible, https://github.com/flutter/flutter/issues/10830
testWidgets('date_and_time_picker_demo', (WidgetTester tester) async { testWidgets('date_and_time_picker_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(home: DateAndTimePickerDemo())); await tester.pumpWidget(const MaterialApp(home: DateAndTimePickerDemo()));
await expectLater(tester, meetsGuideline(labeledTapTargetGuideline)); await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
handle.dispose(); handle.dispose();
}); });
testWidgets('dialog_demo', (WidgetTester tester) async { testWidgets('dialog_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(home: DialogDemo())); await tester.pumpWidget(const MaterialApp(home: DialogDemo()));
await expectLater(tester, meetsGuideline(labeledTapTargetGuideline)); await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
handle.dispose(); handle.dispose();
}); });
testWidgets('drawer_demo', (WidgetTester tester) async { testWidgets('drawer_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(home: DrawerDemo())); await tester.pumpWidget(const MaterialApp(home: DrawerDemo()));
await expectLater(tester, meetsGuideline(labeledTapTargetGuideline)); await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
handle.dispose(); handle.dispose();
}); });
testWidgets('elevation_demo', (WidgetTester tester) async { testWidgets('elevation_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(home: ElevationDemo())); await tester.pumpWidget(const MaterialApp(home: ElevationDemo()));
await expectLater(tester, meetsGuideline(labeledTapTargetGuideline)); await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
handle.dispose(); handle.dispose();
}); });
testWidgets('expansion_panels_demo', (WidgetTester tester) async { testWidgets('expansion_panels_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(home: ExpansionPanelsDemo())); await tester.pumpWidget(const MaterialApp(home: ExpansionPanelsDemo()));
await expectLater(tester, meetsGuideline(labeledTapTargetGuideline)); await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
handle.dispose(); handle.dispose();
}); });
...@@ -336,7 +336,7 @@ void main() { ...@@ -336,7 +336,7 @@ void main() {
testWidgets('icons_demo', (WidgetTester tester) async { testWidgets('icons_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(home: IconsDemo())); await tester.pumpWidget(const MaterialApp(home: IconsDemo()));
await expectLater(tester, meetsGuideline(labeledTapTargetGuideline)); await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
handle.dispose(); handle.dispose();
}); });
...@@ -364,7 +364,7 @@ void main() { ...@@ -364,7 +364,7 @@ void main() {
testWidgets('modal_bottom_sheet_demo', (WidgetTester tester) async { testWidgets('modal_bottom_sheet_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(home: ModalBottomSheetDemo())); await tester.pumpWidget(const MaterialApp(home: ModalBottomSheetDemo()));
await expectLater(tester, meetsGuideline(labeledTapTargetGuideline)); await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
handle.dispose(); handle.dispose();
}); });
...@@ -378,21 +378,21 @@ void main() { ...@@ -378,21 +378,21 @@ void main() {
testWidgets('page_selector_demo', (WidgetTester tester) async { testWidgets('page_selector_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(home: PageSelectorDemo())); await tester.pumpWidget(const MaterialApp(home: PageSelectorDemo()));
await expectLater(tester, meetsGuideline(labeledTapTargetGuideline)); await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
handle.dispose(); handle.dispose();
}); });
testWidgets('persistent_bottom_sheet_demo', (WidgetTester tester) async { testWidgets('persistent_bottom_sheet_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(home: PersistentBottomSheetDemo())); await tester.pumpWidget(const MaterialApp(home: PersistentBottomSheetDemo()));
await expectLater(tester, meetsGuideline(labeledTapTargetGuideline)); await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
handle.dispose(); handle.dispose();
}); });
testWidgets('progress_indicator_demo', (WidgetTester tester) async { testWidgets('progress_indicator_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(home: ProgressIndicatorDemo())); await tester.pumpWidget(const MaterialApp(home: ProgressIndicatorDemo()));
await expectLater(tester, meetsGuideline(labeledTapTargetGuideline)); await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
handle.dispose(); handle.dispose();
}); });
...@@ -406,28 +406,28 @@ void main() { ...@@ -406,28 +406,28 @@ void main() {
testWidgets('scrollable_tabs_demo', (WidgetTester tester) async { testWidgets('scrollable_tabs_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(home: ScrollableTabsDemo())); await tester.pumpWidget(const MaterialApp(home: ScrollableTabsDemo()));
await expectLater(tester, meetsGuideline(labeledTapTargetGuideline)); await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
handle.dispose(); handle.dispose();
}); });
testWidgets('search_demo', (WidgetTester tester) async { testWidgets('search_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(home: SearchDemo())); await tester.pumpWidget(const MaterialApp(home: SearchDemo()));
await expectLater(tester, meetsGuideline(labeledTapTargetGuideline)); await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
handle.dispose(); handle.dispose();
}); });
testWidgets('selection_controls_demo', (WidgetTester tester) async { testWidgets('selection_controls_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(home: SelectionControlsDemo())); await tester.pumpWidget(const MaterialApp(home: SelectionControlsDemo()));
await expectLater(tester, meetsGuideline(labeledTapTargetGuideline)); await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
handle.dispose(); handle.dispose();
}); });
testWidgets('slider_demo', (WidgetTester tester) async { testWidgets('slider_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(home: SliderDemo())); await tester.pumpWidget(const MaterialApp(home: SliderDemo()));
await expectLater(tester, meetsGuideline(labeledTapTargetGuideline)); await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
handle.dispose(); handle.dispose();
}); });
...@@ -441,14 +441,14 @@ void main() { ...@@ -441,14 +441,14 @@ void main() {
testWidgets('tabs_demo', (WidgetTester tester) async { testWidgets('tabs_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(home: TabsDemo())); await tester.pumpWidget(const MaterialApp(home: TabsDemo()));
await expectLater(tester, meetsGuideline(labeledTapTargetGuideline)); await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
handle.dispose(); handle.dispose();
}); });
testWidgets('tabs_fab_demo', (WidgetTester tester) async { testWidgets('tabs_fab_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(home: TabsFabDemo())); await tester.pumpWidget(const MaterialApp(home: TabsFabDemo()));
await expectLater(tester, meetsGuideline(labeledTapTargetGuideline)); await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
handle.dispose(); handle.dispose();
}); });
...@@ -462,14 +462,14 @@ void main() { ...@@ -462,14 +462,14 @@ void main() {
testWidgets('tooltip_demo', (WidgetTester tester) async { testWidgets('tooltip_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(home: TooltipDemo())); await tester.pumpWidget(const MaterialApp(home: TooltipDemo()));
await expectLater(tester, meetsGuideline(labeledTapTargetGuideline)); await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
handle.dispose(); handle.dispose();
}); });
testWidgets('expansion_tile_list_demo', (WidgetTester tester) async { testWidgets('expansion_tile_list_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(home: ExpansionTileListDemo())); await tester.pumpWidget(const MaterialApp(home: ExpansionTileListDemo()));
await expectLater(tester, meetsGuideline(labeledTapTargetGuideline)); await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
handle.dispose(); handle.dispose();
}); });
...@@ -493,7 +493,7 @@ void main() { ...@@ -493,7 +493,7 @@ void main() {
testWidgets('backdrop_demo $themeName', (WidgetTester tester) async { testWidgets('backdrop_demo $themeName', (WidgetTester tester) async {
tester.binding.addTime(const Duration(seconds: 3)); tester.binding.addTime(const Duration(seconds: 3));
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(theme: theme, home: BackdropDemo())); await tester.pumpWidget(MaterialApp(theme: theme, home: const BackdropDemo()));
await expectLater(tester, meetsGuideline(textContrastGuideline)); await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose(); handle.dispose();
}); });
...@@ -501,7 +501,7 @@ void main() { ...@@ -501,7 +501,7 @@ void main() {
testWidgets('bottom_app_bar_demo $themeName', (WidgetTester tester) async { testWidgets('bottom_app_bar_demo $themeName', (WidgetTester tester) async {
tester.binding.addTime(const Duration(seconds: 3)); tester.binding.addTime(const Duration(seconds: 3));
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(theme: theme, home: BottomAppBarDemo())); await tester.pumpWidget(MaterialApp(theme: theme, home: const BottomAppBarDemo()));
await expectLater(tester, meetsGuideline(textContrastGuideline)); await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose(); handle.dispose();
}); });
...@@ -509,7 +509,7 @@ void main() { ...@@ -509,7 +509,7 @@ void main() {
testWidgets('bottom_navigation_demo $themeName', (WidgetTester tester) async { testWidgets('bottom_navigation_demo $themeName', (WidgetTester tester) async {
tester.binding.addTime(const Duration(seconds: 3)); tester.binding.addTime(const Duration(seconds: 3));
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(theme: theme, home: BottomNavigationDemo())); await tester.pumpWidget(MaterialApp(theme: theme, home: const BottomNavigationDemo()));
await expectLater(tester, meetsGuideline(textContrastGuideline)); await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose(); handle.dispose();
}); });
...@@ -517,7 +517,7 @@ void main() { ...@@ -517,7 +517,7 @@ void main() {
testWidgets('buttons_demo $themeName', (WidgetTester tester) async { testWidgets('buttons_demo $themeName', (WidgetTester tester) async {
tester.binding.addTime(const Duration(seconds: 3)); tester.binding.addTime(const Duration(seconds: 3));
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(theme: theme, home: ButtonsDemo())); await tester.pumpWidget(MaterialApp(theme: theme, home: const ButtonsDemo()));
await expectLater(tester, meetsGuideline(textContrastGuideline)); await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose(); handle.dispose();
}); });
...@@ -525,7 +525,7 @@ void main() { ...@@ -525,7 +525,7 @@ void main() {
testWidgets('cards_demo $themeName', (WidgetTester tester) async { testWidgets('cards_demo $themeName', (WidgetTester tester) async {
tester.binding.addTime(const Duration(seconds: 3)); tester.binding.addTime(const Duration(seconds: 3));
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(theme: theme, home: CardsDemo())); await tester.pumpWidget(MaterialApp(theme: theme, home: const CardsDemo()));
await expectLater(tester, meetsGuideline(textContrastGuideline)); await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose(); handle.dispose();
}); });
...@@ -533,7 +533,7 @@ void main() { ...@@ -533,7 +533,7 @@ void main() {
testWidgets('chip_demo $themeName', (WidgetTester tester) async { testWidgets('chip_demo $themeName', (WidgetTester tester) async {
tester.binding.addTime(const Duration(seconds: 3)); tester.binding.addTime(const Duration(seconds: 3));
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(theme: theme, home: ChipDemo())); await tester.pumpWidget(MaterialApp(theme: theme, home: const ChipDemo()));
await expectLater(tester, meetsGuideline(textContrastGuideline)); await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose(); handle.dispose();
}); });
...@@ -541,7 +541,7 @@ void main() { ...@@ -541,7 +541,7 @@ void main() {
testWidgets('data_table_demo $themeName', (WidgetTester tester) async { testWidgets('data_table_demo $themeName', (WidgetTester tester) async {
tester.binding.addTime(const Duration(seconds: 3)); tester.binding.addTime(const Duration(seconds: 3));
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(theme: theme, home: DataTableDemo())); await tester.pumpWidget(MaterialApp(theme: theme, home: const DataTableDemo()));
await expectLater(tester, meetsGuideline(textContrastGuideline)); await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose(); handle.dispose();
}); });
...@@ -549,7 +549,7 @@ void main() { ...@@ -549,7 +549,7 @@ void main() {
testWidgets('date_and_time_picker_demo $themeName', (WidgetTester tester) async { testWidgets('date_and_time_picker_demo $themeName', (WidgetTester tester) async {
tester.binding.addTime(const Duration(seconds: 3)); tester.binding.addTime(const Duration(seconds: 3));
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(theme: theme, home: DateAndTimePickerDemo())); await tester.pumpWidget(MaterialApp(theme: theme, home: const DateAndTimePickerDemo()));
await expectLater(tester, meetsGuideline(textContrastGuideline)); await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose(); handle.dispose();
}); });
...@@ -557,7 +557,7 @@ void main() { ...@@ -557,7 +557,7 @@ void main() {
testWidgets('dialog_demo $themeName', (WidgetTester tester) async { testWidgets('dialog_demo $themeName', (WidgetTester tester) async {
tester.binding.addTime(const Duration(seconds: 3)); tester.binding.addTime(const Duration(seconds: 3));
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(theme: theme, home: DialogDemo())); await tester.pumpWidget(MaterialApp(theme: theme, home: const DialogDemo()));
await expectLater(tester, meetsGuideline(textContrastGuideline)); await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose(); handle.dispose();
}, skip: theme == ThemeData.dark()); // Raised Button does not follow }, skip: theme == ThemeData.dark()); // Raised Button does not follow
...@@ -567,7 +567,7 @@ void main() { ...@@ -567,7 +567,7 @@ void main() {
testWidgets('drawer_demo $themeName', (WidgetTester tester) async { testWidgets('drawer_demo $themeName', (WidgetTester tester) async {
tester.binding.addTime(const Duration(seconds: 3)); tester.binding.addTime(const Duration(seconds: 3));
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(theme: theme, home: DrawerDemo())); await tester.pumpWidget(MaterialApp(theme: theme, home: const DrawerDemo()));
await expectLater(tester, meetsGuideline(textContrastGuideline)); await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose(); handle.dispose();
}); });
...@@ -575,7 +575,7 @@ void main() { ...@@ -575,7 +575,7 @@ void main() {
testWidgets('elevation_demo $themeName', (WidgetTester tester) async { testWidgets('elevation_demo $themeName', (WidgetTester tester) async {
tester.binding.addTime(const Duration(seconds: 3)); tester.binding.addTime(const Duration(seconds: 3));
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(theme: theme, home: ElevationDemo())); await tester.pumpWidget(MaterialApp(theme: theme, home: const ElevationDemo()));
await expectLater(tester, meetsGuideline(textContrastGuideline)); await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose(); handle.dispose();
}); });
...@@ -583,7 +583,7 @@ void main() { ...@@ -583,7 +583,7 @@ void main() {
testWidgets('expansion_panels_demo $themeName', (WidgetTester tester) async { testWidgets('expansion_panels_demo $themeName', (WidgetTester tester) async {
tester.binding.addTime(const Duration(seconds: 3)); tester.binding.addTime(const Duration(seconds: 3));
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(theme: theme, home: ExpansionPanelsDemo())); await tester.pumpWidget(MaterialApp(theme: theme, home: const ExpansionPanelsDemo()));
await expectLater(tester, meetsGuideline(textContrastGuideline)); await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose(); handle.dispose();
}); });
...@@ -599,7 +599,7 @@ void main() { ...@@ -599,7 +599,7 @@ void main() {
testWidgets('icons_demo $themeName', (WidgetTester tester) async { testWidgets('icons_demo $themeName', (WidgetTester tester) async {
tester.binding.addTime(const Duration(seconds: 3)); tester.binding.addTime(const Duration(seconds: 3));
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(theme: theme, home: IconsDemo())); await tester.pumpWidget(MaterialApp(theme: theme, home: const IconsDemo()));
await expectLater(tester, meetsGuideline(textContrastGuideline)); await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose(); handle.dispose();
}); });
...@@ -632,7 +632,7 @@ void main() { ...@@ -632,7 +632,7 @@ void main() {
tester.binding.addTime(const Duration(seconds: 3)); tester.binding.addTime(const Duration(seconds: 3));
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp(theme: theme, home: ModalBottomSheetDemo()) MaterialApp(theme: theme, home: const ModalBottomSheetDemo())
); );
await expectLater(tester, meetsGuideline(textContrastGuideline)); await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose(); handle.dispose();
...@@ -651,7 +651,7 @@ void main() { ...@@ -651,7 +651,7 @@ void main() {
testWidgets('page_selector_demo $themeName', (WidgetTester tester) async { testWidgets('page_selector_demo $themeName', (WidgetTester tester) async {
tester.binding.addTime(const Duration(seconds: 3)); tester.binding.addTime(const Duration(seconds: 3));
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(theme: theme, home: PageSelectorDemo())); await tester.pumpWidget(MaterialApp(theme: theme, home: const PageSelectorDemo()));
await expectLater(tester, meetsGuideline(textContrastGuideline)); await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose(); handle.dispose();
}); });
...@@ -660,7 +660,7 @@ void main() { ...@@ -660,7 +660,7 @@ void main() {
tester.binding.addTime(const Duration(seconds: 3)); tester.binding.addTime(const Duration(seconds: 3));
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp(theme: theme, home: PersistentBottomSheetDemo()) MaterialApp(theme: theme, home: const PersistentBottomSheetDemo())
); );
await expectLater(tester, meetsGuideline(textContrastGuideline)); await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose(); handle.dispose();
...@@ -671,7 +671,7 @@ void main() { ...@@ -671,7 +671,7 @@ void main() {
testWidgets('progress_indicator_demo $themeName', (WidgetTester tester) async { testWidgets('progress_indicator_demo $themeName', (WidgetTester tester) async {
tester.binding.addTime(const Duration(seconds: 3)); tester.binding.addTime(const Duration(seconds: 3));
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(theme: theme, home: ProgressIndicatorDemo())); await tester.pumpWidget(MaterialApp(theme: theme, home: const ProgressIndicatorDemo()));
await expectLater(tester, meetsGuideline(textContrastGuideline)); await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose(); handle.dispose();
}); });
...@@ -687,7 +687,7 @@ void main() { ...@@ -687,7 +687,7 @@ void main() {
testWidgets('scrollable_tabs_demo $themeName', (WidgetTester tester) async { testWidgets('scrollable_tabs_demo $themeName', (WidgetTester tester) async {
tester.binding.addTime(const Duration(seconds: 3)); tester.binding.addTime(const Duration(seconds: 3));
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(theme: theme, home: ScrollableTabsDemo())); await tester.pumpWidget(MaterialApp(theme: theme, home: const ScrollableTabsDemo()));
await expectLater(tester, meetsGuideline(textContrastGuideline)); await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose(); handle.dispose();
}); });
...@@ -695,7 +695,7 @@ void main() { ...@@ -695,7 +695,7 @@ void main() {
testWidgets('search_demo $themeName', (WidgetTester tester) async { testWidgets('search_demo $themeName', (WidgetTester tester) async {
tester.binding.addTime(const Duration(seconds: 3)); tester.binding.addTime(const Duration(seconds: 3));
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(theme: theme, home: SearchDemo())); await tester.pumpWidget(MaterialApp(theme: theme, home: const SearchDemo()));
await expectLater(tester, meetsGuideline(textContrastGuideline)); await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose(); handle.dispose();
}); });
...@@ -703,7 +703,7 @@ void main() { ...@@ -703,7 +703,7 @@ void main() {
testWidgets('selection_controls_demo $themeName', (WidgetTester tester) async { testWidgets('selection_controls_demo $themeName', (WidgetTester tester) async {
tester.binding.addTime(const Duration(seconds: 3)); tester.binding.addTime(const Duration(seconds: 3));
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(theme: theme, home: SelectionControlsDemo())); await tester.pumpWidget(MaterialApp(theme: theme, home: const SelectionControlsDemo()));
await expectLater(tester, meetsGuideline(textContrastGuideline)); await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose(); handle.dispose();
}); });
...@@ -711,7 +711,7 @@ void main() { ...@@ -711,7 +711,7 @@ void main() {
testWidgets('slider_demo $themeName', (WidgetTester tester) async { testWidgets('slider_demo $themeName', (WidgetTester tester) async {
tester.binding.addTime(const Duration(seconds: 3)); tester.binding.addTime(const Duration(seconds: 3));
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(theme: theme, home: SliderDemo())); await tester.pumpWidget(MaterialApp(theme: theme, home: const SliderDemo()));
await expectLater(tester, meetsGuideline(textContrastGuideline)); await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose(); handle.dispose();
}); });
...@@ -731,7 +731,7 @@ void main() { ...@@ -731,7 +731,7 @@ void main() {
testWidgets('tabs_demo $themeName', (WidgetTester tester) async { testWidgets('tabs_demo $themeName', (WidgetTester tester) async {
tester.binding.addTime(const Duration(seconds: 3)); tester.binding.addTime(const Duration(seconds: 3));
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(theme: theme, home: TabsDemo())); await tester.pumpWidget(MaterialApp(theme: theme, home: const TabsDemo()));
await expectLater(tester, meetsGuideline(textContrastGuideline)); await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose(); handle.dispose();
}); });
...@@ -739,7 +739,7 @@ void main() { ...@@ -739,7 +739,7 @@ void main() {
testWidgets('tabs_fab_demo $themeName', (WidgetTester tester) async { testWidgets('tabs_fab_demo $themeName', (WidgetTester tester) async {
tester.binding.addTime(const Duration(seconds: 3)); tester.binding.addTime(const Duration(seconds: 3));
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(theme: theme, home: TabsFabDemo())); await tester.pumpWidget(MaterialApp(theme: theme, home: const TabsFabDemo()));
await expectLater(tester, meetsGuideline(textContrastGuideline)); await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose(); handle.dispose();
}); });
...@@ -755,7 +755,7 @@ void main() { ...@@ -755,7 +755,7 @@ void main() {
testWidgets('tooltip_demo $themeName', (WidgetTester tester) async { testWidgets('tooltip_demo $themeName', (WidgetTester tester) async {
tester.binding.addTime(const Duration(seconds: 3)); tester.binding.addTime(const Duration(seconds: 3));
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(theme: theme, home: TooltipDemo())); await tester.pumpWidget(MaterialApp(theme: theme, home: const TooltipDemo()));
await expectLater(tester, meetsGuideline(textContrastGuideline)); await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose(); handle.dispose();
}); });
...@@ -763,7 +763,7 @@ void main() { ...@@ -763,7 +763,7 @@ void main() {
testWidgets('expansion_tile_list_demo $themeName', (WidgetTester tester) async { testWidgets('expansion_tile_list_demo $themeName', (WidgetTester tester) async {
tester.binding.addTime(const Duration(seconds: 3)); tester.binding.addTime(const Duration(seconds: 3));
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(theme: theme, home: ExpansionTileListDemo())); await tester.pumpWidget(MaterialApp(theme: theme, home: const ExpansionTileListDemo()));
await expectLater(tester, meetsGuideline(textContrastGuideline)); await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose(); handle.dispose();
}); });
......
...@@ -11,7 +11,7 @@ void main() { ...@@ -11,7 +11,7 @@ void main() {
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp( await tester.pumpWidget(MaterialApp(
theme: ThemeData(platform: TargetPlatform.iOS), theme: ThemeData(platform: TargetPlatform.iOS),
home: ChipDemo(), home: const ChipDemo(),
)); ));
expect(tester.getSemantics(find.byIcon(Icons.vignette)), matchesSemantics( expect(tester.getSemantics(find.byIcon(Icons.vignette)), matchesSemantics(
......
...@@ -10,7 +10,7 @@ void main() { ...@@ -10,7 +10,7 @@ void main() {
testWidgets('Drawer header does not scroll', (WidgetTester tester) async { testWidgets('Drawer header does not scroll', (WidgetTester tester) async {
await tester.pumpWidget(MaterialApp( await tester.pumpWidget(MaterialApp(
theme: ThemeData(platform: TargetPlatform.iOS), theme: ThemeData(platform: TargetPlatform.iOS),
home: DrawerDemo(), home: const DrawerDemo(),
)); ));
await tester.tap(find.text('Tap here to open the drawer')); await tester.tap(find.text('Tap here to open the drawer'));
......
...@@ -8,7 +8,7 @@ import 'package:flutter_test/flutter_test.dart'; ...@@ -8,7 +8,7 @@ import 'package:flutter_test/flutter_test.dart';
Future<void> main() async { Future<void> main() async {
testWidgets('Expansion panel demo: radio tile selection changes on tap', (WidgetTester tester) async { testWidgets('Expansion panel demo: radio tile selection changes on tap', (WidgetTester tester) async {
await tester.pumpWidget(MaterialApp(home: ExpansionPanelsDemo())); await tester.pumpWidget(const MaterialApp(home: ExpansionPanelsDemo()));
expect(_expandIcons, findsNWidgets(3)); expect(_expandIcons, findsNWidgets(3));
......
...@@ -17,10 +17,12 @@ final List<PageWidget> _allPages = <PageWidget>[ ...@@ -17,10 +17,12 @@ final List<PageWidget> _allPages = <PageWidget>[
void main() { void main() {
enableFlutterDriverExtension(handler: driverDataHandler.handleMessage); enableFlutterDriverExtension(handler: driverDataHandler.handleMessage);
runApp(MaterialApp(home: Home())); runApp(const MaterialApp(home: Home()));
} }
class Home extends StatelessWidget { class Home extends StatelessWidget {
const Home({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
......
...@@ -17,16 +17,18 @@ import 'page.dart'; ...@@ -17,16 +17,18 @@ import 'page.dart';
const String kEventsFileName = 'touchEvents'; const String kEventsFileName = 'touchEvents';
class MotionEventsPage extends PageWidget { class MotionEventsPage extends PageWidget {
const MotionEventsPage() const MotionEventsPage({Key key})
: super('Motion Event Tests', const ValueKey<String>('MotionEventsListTile')); : super('Motion Event Tests', const ValueKey<String>('MotionEventsListTile'), key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return MotionEventsBody(); return const MotionEventsBody();
} }
} }
class MotionEventsBody extends StatefulWidget { class MotionEventsBody extends StatefulWidget {
const MotionEventsBody({Key key}) : super(key: key);
@override @override
State createState() => MotionEventsBodyState(); State createState() => MotionEventsBodyState();
} }
...@@ -223,7 +225,7 @@ class MotionEventsBodyState extends State<MotionEventsBody> { ...@@ -223,7 +225,7 @@ class MotionEventsBodyState extends State<MotionEventsBody> {
} }
class TouchEventDiff extends StatelessWidget { class TouchEventDiff extends StatelessWidget {
const TouchEventDiff(this.originalEvent, this.synthesizedEvent); const TouchEventDiff(this.originalEvent, this.synthesizedEvent, {Key key}) : super(key: key);
final Map<String, dynamic> originalEvent; final Map<String, dynamic> originalEvent;
final Map<String, dynamic> synthesizedEvent; final Map<String, dynamic> synthesizedEvent;
......
...@@ -12,14 +12,16 @@ import 'future_data_handler.dart'; ...@@ -12,14 +12,16 @@ import 'future_data_handler.dart';
import 'page.dart'; import 'page.dart';
class NestedViewEventPage extends PageWidget { class NestedViewEventPage extends PageWidget {
const NestedViewEventPage() const NestedViewEventPage({Key key})
: super('Nested View Event Tests', const ValueKey<String>('NestedViewEventTile')); : super('Nested View Event Tests', const ValueKey<String>('NestedViewEventTile'), key: key);
@override @override
Widget build(BuildContext context) => NestedViewEventBody(); Widget build(BuildContext context) => const NestedViewEventBody();
} }
class NestedViewEventBody extends StatefulWidget { class NestedViewEventBody extends StatefulWidget {
const NestedViewEventBody({Key key}) : super(key: key);
@override @override
State<NestedViewEventBody> createState() => NestedViewEventBodyState(); State<NestedViewEventBody> createState() => NestedViewEventBodyState();
} }
......
...@@ -8,7 +8,7 @@ import 'package:flutter/material.dart'; ...@@ -8,7 +8,7 @@ import 'package:flutter/material.dart';
// //
/// A testing page has to override this in order to be put as one of the items in the main page. /// A testing page has to override this in order to be put as one of the items in the main page.
abstract class PageWidget extends StatelessWidget { abstract class PageWidget extends StatelessWidget {
const PageWidget(this.title, this.tileKey); const PageWidget(this.title, this.tileKey, {Key key}) : super(key: key);
/// The title of the testing page /// The title of the testing page
/// ///
......
...@@ -28,7 +28,7 @@ void main() { ...@@ -28,7 +28,7 @@ void main() {
/// ///
/// Rewiring semantics is a signal to native IOS test that the test has passed. /// Rewiring semantics is a signal to native IOS test that the test has passed.
class LifeCycleSpy extends StatefulWidget { class LifeCycleSpy extends StatefulWidget {
const LifeCycleSpy(); const LifeCycleSpy({Key key}) : super(key: key);
@override @override
_LifeCycleSpyState createState() => _LifeCycleSpyState(); _LifeCycleSpyState createState() => _LifeCycleSpyState();
......
...@@ -4,9 +4,11 @@ ...@@ -4,9 +4,11 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
void main() => runApp(MyApp()); void main() => runApp(const MyApp());
class MyApp extends StatelessWidget { class MyApp extends StatelessWidget {
const MyApp({Key key}) : super(key: key);
// This widget is the root of your application. // This widget is the root of your application.
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
......
...@@ -7,11 +7,13 @@ import 'package:flutter_driver/driver_extension.dart'; ...@@ -7,11 +7,13 @@ import 'package:flutter_driver/driver_extension.dart';
void main() { void main() {
enableFlutterDriverExtension(); enableFlutterDriverExtension();
runApp(MyApp()); runApp(const MyApp());
} }
/// The main app entrance of the test /// The main app entrance of the test
class MyApp extends StatelessWidget { class MyApp extends StatelessWidget {
const MyApp({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return MaterialApp( return MaterialApp(
...@@ -50,7 +52,7 @@ class _MyHomePageState extends State<MyHomePage> { ...@@ -50,7 +52,7 @@ class _MyHomePageState extends State<MyHomePage> {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute<PlatformViewPage>( MaterialPageRoute<PlatformViewPage>(
builder: (BuildContext context) => PlatformViewPage()), builder: (BuildContext context) => const PlatformViewPage()),
); );
}, },
), ),
...@@ -67,7 +69,9 @@ class _MyHomePageState extends State<MyHomePage> { ...@@ -67,7 +69,9 @@ class _MyHomePageState extends State<MyHomePage> {
/// A page contains the platform view to be tested. /// A page contains the platform view to be tested.
class PlatformViewPage extends StatelessWidget { class PlatformViewPage extends StatelessWidget {
final Key button = const ValueKey<String>('plus_button'); const PlatformViewPage({Key key}) : super(key: key);
static Key button = const ValueKey<String>('plus_button');
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
......
...@@ -7,10 +7,12 @@ import 'package:flutter/material.dart'; ...@@ -7,10 +7,12 @@ import 'package:flutter/material.dart';
String? unused; String? unused;
void main() { void main() {
runApp(MyApp()); runApp(const MyApp());
} }
class MyApp extends StatelessWidget { class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return MaterialApp( return MaterialApp(
......
...@@ -12,10 +12,12 @@ import 'src/test_step.dart'; ...@@ -12,10 +12,12 @@ import 'src/test_step.dart';
void main() { void main() {
enableFlutterDriverExtension(); enableFlutterDriverExtension();
runApp(TestApp()); runApp(const TestApp());
} }
class TestApp extends StatefulWidget { class TestApp extends StatefulWidget {
const TestApp({Key key}) : super(key: key);
@override @override
_TestAppState createState() => _TestAppState(); _TestAppState createState() => _TestAppState();
} }
......
...@@ -7,10 +7,12 @@ import 'package:flutter_driver/driver_extension.dart'; ...@@ -7,10 +7,12 @@ import 'package:flutter_driver/driver_extension.dart';
void main() { void main() {
enableFlutterDriverExtension(); enableFlutterDriverExtension();
runApp(DriverTestApp()); runApp(const DriverTestApp());
} }
class DriverTestApp extends StatefulWidget { class DriverTestApp extends StatefulWidget {
const DriverTestApp({Key key}) : super(key: key);
@override @override
State<StatefulWidget> createState() { State<StatefulWidget> createState() {
return DriverTestAppState(); return DriverTestAppState();
......
...@@ -8,10 +8,12 @@ import 'package:flutter_driver/driver_extension.dart'; ...@@ -8,10 +8,12 @@ import 'package:flutter_driver/driver_extension.dart';
/// This application does nothing but show a empty screen. /// This application does nothing but show a empty screen.
void main() { void main() {
enableFlutterDriverExtension(); enableFlutterDriverExtension();
runApp(Empty()); runApp(const Empty());
} }
class Empty extends StatelessWidget { class Empty extends StatelessWidget {
const Empty({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) => Container(); Widget build(BuildContext context) => Container();
} }
...@@ -12,21 +12,25 @@ void main() { ...@@ -12,21 +12,25 @@ void main() {
// TODO(cbernaschina): remove when test flakiness is resolved // TODO(cbernaschina): remove when test flakiness is resolved
return 'keyboard_resize'; return 'keyboard_resize';
}); });
runApp(MyApp()); runApp(const MyApp());
} }
class MyApp extends StatelessWidget { class MyApp extends StatelessWidget {
const MyApp({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return MaterialApp( return MaterialApp(
title: 'Text Editing', title: 'Text Editing',
theme: ThemeData(primarySwatch: Colors.blue), theme: ThemeData(primarySwatch: Colors.blue),
home: MyHomePage(), home: const MyHomePage(),
); );
} }
} }
class MyHomePage extends StatefulWidget { class MyHomePage extends StatefulWidget {
const MyHomePage({Key key}) : super(key: key);
@override @override
_MyHomePageState createState() => _MyHomePageState(); _MyHomePageState createState() => _MyHomePageState();
} }
......
...@@ -10,21 +10,25 @@ import 'keys.dart' as keys; ...@@ -10,21 +10,25 @@ import 'keys.dart' as keys;
void main() { void main() {
enableFlutterDriverExtension(); enableFlutterDriverExtension();
runApp(MyApp()); runApp(const MyApp());
} }
class MyApp extends StatelessWidget { class MyApp extends StatelessWidget {
const MyApp({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return MaterialApp( return MaterialApp(
title: 'Keyboard & TextField', title: 'Keyboard & TextField',
theme: ThemeData(primarySwatch: Colors.blue), theme: ThemeData(primarySwatch: Colors.blue),
home: MyHomePage(), home: const MyHomePage(),
); );
} }
} }
class MyHomePage extends StatefulWidget { class MyHomePage extends StatefulWidget {
const MyHomePage({Key key}) : super(key: key);
@override @override
_MyHomePageState createState() => _MyHomePageState(); _MyHomePageState createState() => _MyHomePageState();
} }
......
...@@ -10,10 +10,12 @@ import 'package:flutter_driver/driver_extension.dart'; ...@@ -10,10 +10,12 @@ import 'package:flutter_driver/driver_extension.dart';
/// license in it. /// license in it.
void main() { void main() {
enableFlutterDriverExtension(); enableFlutterDriverExtension();
runApp(ShowLicenses()); runApp(const ShowLicenses());
} }
class ShowLicenses extends StatelessWidget { class ShowLicenses extends StatelessWidget {
const ShowLicenses({Key key}) : super(key: key);
Widget _buildTestResultWidget( Widget _buildTestResultWidget(
BuildContext context, BuildContext context,
AsyncSnapshot<List<LicenseEntry>> snapshot, AsyncSnapshot<List<LicenseEntry>> snapshot,
......
...@@ -12,10 +12,12 @@ import 'package:flutter_driver/driver_extension.dart'; ...@@ -12,10 +12,12 @@ import 'package:flutter_driver/driver_extension.dart';
void main() { void main() {
enableFlutterDriverExtension(); enableFlutterDriverExtension();
runApp(Toggler()); runApp(const Toggler());
} }
class Toggler extends StatefulWidget { class Toggler extends StatefulWidget {
const Toggler({Key key}) : super(key: key);
@override @override
State<Toggler> createState() => TogglerState(); State<Toggler> createState() => TogglerState();
} }
......
...@@ -4,9 +4,11 @@ ...@@ -4,9 +4,11 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
void main() => runApp(MyApp()); void main() => runApp(const MyApp());
class MyApp extends StatelessWidget { class MyApp extends StatelessWidget {
const MyApp({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return const MaterialApp( return const MaterialApp(
......
...@@ -294,7 +294,7 @@ class UndoableDirectionalFocusAction extends UndoableFocusActionBase<Directional ...@@ -294,7 +294,7 @@ class UndoableDirectionalFocusAction extends UndoableFocusActionBase<Directional
/// A button class that takes focus when clicked. /// A button class that takes focus when clicked.
class DemoButton extends StatefulWidget { class DemoButton extends StatefulWidget {
const DemoButton({this.name}); const DemoButton({Key key, this.name}) : super(key: key);
final String name; final String name;
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class AnimatedIconsTestApp extends StatelessWidget { class AnimatedIconsTestApp extends StatelessWidget {
const AnimatedIconsTestApp({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return const MaterialApp( return const MaterialApp(
...@@ -17,7 +19,7 @@ class AnimatedIconsTestApp extends StatelessWidget { ...@@ -17,7 +19,7 @@ class AnimatedIconsTestApp extends StatelessWidget {
} }
class IconsList extends StatelessWidget { class IconsList extends StatelessWidget {
const IconsList(); const IconsList({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
...@@ -28,7 +30,7 @@ class IconsList extends StatelessWidget { ...@@ -28,7 +30,7 @@ class IconsList extends StatelessWidget {
} }
class IconSampleRow extends StatefulWidget { class IconSampleRow extends StatefulWidget {
const IconSampleRow(this.sample); const IconSampleRow(this.sample, {Key key}) : super(key: key);
final IconSample sample; final IconSample sample;
...@@ -105,4 +107,4 @@ class IconSample { ...@@ -105,4 +107,4 @@ class IconSample {
final String description; final String description;
} }
void main() => runApp(AnimatedIconsTestApp()); void main() => runApp(const AnimatedIconsTestApp());
...@@ -18,6 +18,8 @@ class CardModel { ...@@ -18,6 +18,8 @@ class CardModel {
} }
class CardCollection extends StatefulWidget { class CardCollection extends StatefulWidget {
const CardCollection({Key key}) : super(key: key);
@override @override
CardCollectionState createState() => CardCollectionState(); CardCollectionState createState() => CardCollectionState();
} }
...@@ -389,7 +391,7 @@ class CardCollectionState extends State<CardCollection> { ...@@ -389,7 +391,7 @@ class CardCollectionState extends State<CardCollection> {
} }
void main() { void main() {
runApp(MaterialApp( runApp(const MaterialApp(
title: 'Cards', title: 'Cards',
home: CardCollection(), home: CardCollection(),
)); ));
......
...@@ -10,10 +10,12 @@ class ColorTestingDemo extends StatelessWidget { ...@@ -10,10 +10,12 @@ class ColorTestingDemo extends StatelessWidget {
static const String routeName = '/color_demo'; static const String routeName = '/color_demo';
@override @override
Widget build(BuildContext context) => ColorDemoHome(); Widget build(BuildContext context) => const ColorDemoHome();
} }
class ColorDemoHome extends StatelessWidget { class ColorDemoHome extends StatelessWidget {
const ColorDemoHome({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
...@@ -85,7 +87,7 @@ class ColorRow extends StatelessWidget { ...@@ -85,7 +87,7 @@ class ColorRow extends StatelessWidget {
} }
void main() { void main() {
runApp(MaterialApp( runApp(const MaterialApp(
title: 'Color Testing Demo', title: 'Color Testing Demo',
home: ColorDemoHome(), home: ColorDemoHome(),
)); ));
......
...@@ -19,9 +19,11 @@ final Map<int, Color> m2SwatchColors = <int, Color>{ ...@@ -19,9 +19,11 @@ final Map<int, Color> m2SwatchColors = <int, Color>{
}; };
final MaterialColor m2Swatch = MaterialColor(m2SwatchColors[500].value, m2SwatchColors); final MaterialColor m2Swatch = MaterialColor(m2SwatchColors[500].value, m2SwatchColors);
void main() => runApp(MyApp()); void main() => runApp(const MyApp());
class MyApp extends StatelessWidget { class MyApp extends StatelessWidget {
const MyApp({Key key}) : super(key: key);
static const String _title = 'Density Test'; static const String _title = 'Density Test';
@override @override
...@@ -132,7 +134,7 @@ class LabeledCheckbox extends StatelessWidget { ...@@ -132,7 +134,7 @@ class LabeledCheckbox extends StatelessWidget {
} }
class Options extends StatefulWidget { class Options extends StatefulWidget {
const Options(this.model); const Options(this.model, {Key key}) : super(key: key);
final OptionModel model; final OptionModel model;
......
...@@ -7,6 +7,8 @@ import 'dart:math' as math; ...@@ -7,6 +7,8 @@ import 'dart:math' as math;
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class ExampleDragTarget extends StatefulWidget { class ExampleDragTarget extends StatefulWidget {
const ExampleDragTarget({Key key}) : super(key: key);
@override @override
ExampleDragTargetState createState() => ExampleDragTargetState(); ExampleDragTargetState createState() => ExampleDragTargetState();
} }
...@@ -174,7 +176,7 @@ class DashOutlineCirclePainter extends CustomPainter { ...@@ -174,7 +176,7 @@ class DashOutlineCirclePainter extends CustomPainter {
} }
class MovableBall extends StatelessWidget { class MovableBall extends StatelessWidget {
const MovableBall(this.position, this.ballPosition, this.callback); const MovableBall(this.position, this.ballPosition, this.callback, {Key key}) : super(key: key);
final int position; final int position;
final int ballPosition; final int ballPosition;
...@@ -223,6 +225,8 @@ class MovableBall extends StatelessWidget { ...@@ -223,6 +225,8 @@ class MovableBall extends StatelessWidget {
} }
class DragAndDropApp extends StatefulWidget { class DragAndDropApp extends StatefulWidget {
const DragAndDropApp({Key key}) : super(key: key);
@override @override
DragAndDropAppState createState() => DragAndDropAppState(); DragAndDropAppState createState() => DragAndDropAppState();
} }
...@@ -270,7 +274,7 @@ class DragAndDropAppState extends State<DragAndDropApp> { ...@@ -270,7 +274,7 @@ class DragAndDropAppState extends State<DragAndDropApp> {
), ),
Expanded( Expanded(
child: Row( child: Row(
children: <Widget>[ children: const <Widget>[
Expanded(child: ExampleDragTarget()), Expanded(child: ExampleDragTarget()),
Expanded(child: ExampleDragTarget()), Expanded(child: ExampleDragTarget()),
Expanded(child: ExampleDragTarget()), Expanded(child: ExampleDragTarget()),
...@@ -295,7 +299,7 @@ class DragAndDropAppState extends State<DragAndDropApp> { ...@@ -295,7 +299,7 @@ class DragAndDropAppState extends State<DragAndDropApp> {
} }
void main() { void main() {
runApp(MaterialApp( runApp(const MaterialApp(
title: 'Drag and Drop Flutter Demo', title: 'Drag and Drop Flutter Demo',
home: DragAndDropApp(), home: DragAndDropApp(),
)); ));
......
...@@ -13,7 +13,7 @@ void main() { ...@@ -13,7 +13,7 @@ void main() {
} }
class DemoButton extends StatefulWidget { class DemoButton extends StatefulWidget {
const DemoButton({this.name, this.canRequestFocus = true, this.autofocus = false}); const DemoButton({Key key, this.name, this.canRequestFocus = true, this.autofocus = false}) : super(key: key);
final String name; final String name;
final bool canRequestFocus; final bool canRequestFocus;
......
...@@ -12,7 +12,7 @@ void main() { ...@@ -12,7 +12,7 @@ void main() {
} }
class DemoButton extends StatelessWidget { class DemoButton extends StatelessWidget {
const DemoButton({this.name}); const DemoButton({Key key, this.name}) : super(key: key);
final String name; final String name;
......
...@@ -86,6 +86,8 @@ class Marker extends StatelessWidget { ...@@ -86,6 +86,8 @@ class Marker extends StatelessWidget {
} }
class OverlayGeometryApp extends StatefulWidget { class OverlayGeometryApp extends StatefulWidget {
const OverlayGeometryApp({Key key}) : super(key: key);
@override @override
OverlayGeometryAppState createState() => OverlayGeometryAppState(); OverlayGeometryAppState createState() => OverlayGeometryAppState();
} }
...@@ -209,6 +211,6 @@ void main() { ...@@ -209,6 +211,6 @@ void main() {
accentColor: Colors.redAccent, accentColor: Colors.redAccent,
), ),
title: 'Cards', title: 'Cards',
home: OverlayGeometryApp(), home: const OverlayGeometryApp(),
)); ));
} }
...@@ -14,6 +14,8 @@ class CardModel { ...@@ -14,6 +14,8 @@ class CardModel {
} }
class PageViewApp extends StatefulWidget { class PageViewApp extends StatefulWidget {
const PageViewApp({Key key}) : super(key: key);
@override @override
PageViewAppState createState() => PageViewAppState(); PageViewAppState createState() => PageViewAppState();
} }
...@@ -146,6 +148,6 @@ void main() { ...@@ -146,6 +148,6 @@ void main() {
primarySwatch: Colors.blue, primarySwatch: Colors.blue,
accentColor: Colors.redAccent, accentColor: Colors.redAccent,
), ),
home: PageViewApp(), home: const PageViewApp(),
)); ));
} }
...@@ -8,7 +8,7 @@ import 'package:manual_tests/overlay_geometry.dart' as overlay_geometry; ...@@ -8,7 +8,7 @@ import 'package:manual_tests/overlay_geometry.dart' as overlay_geometry;
void main() { void main() {
testWidgets('Overlay geometry smoke test', (WidgetTester tester) async { testWidgets('Overlay geometry smoke test', (WidgetTester tester) async {
await tester.pumpWidget(MaterialApp(home: overlay_geometry.OverlayGeometryApp())); await tester.pumpWidget(const MaterialApp(home: overlay_geometry.OverlayGeometryApp()));
expect(find.byType(overlay_geometry.Marker), findsNothing); expect(find.byType(overlay_geometry.Marker), findsNothing);
await tester.tap(find.text('Card 3')); await tester.tap(find.text('Card 3'));
await tester.pump(); await tester.pump();
......
...@@ -7,10 +7,12 @@ import 'package:flutter/material.dart'; ...@@ -7,10 +7,12 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
void main() { void main() {
runApp(FlutterView()); runApp(const FlutterView());
} }
class FlutterView extends StatelessWidget { class FlutterView extends StatelessWidget {
const FlutterView({Key? key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return MaterialApp( return MaterialApp(
...@@ -18,12 +20,14 @@ class FlutterView extends StatelessWidget { ...@@ -18,12 +20,14 @@ class FlutterView extends StatelessWidget {
theme: ThemeData( theme: ThemeData(
primarySwatch: Colors.grey, primarySwatch: Colors.grey,
), ),
home: MyHomePage(), home: const MyHomePage(),
); );
} }
} }
class MyHomePage extends StatefulWidget { class MyHomePage extends StatefulWidget {
const MyHomePage({Key? key}) : super(key: key);
@override @override
_MyHomePageState createState() => _MyHomePageState(); _MyHomePageState createState() => _MyHomePageState();
} }
......
...@@ -124,7 +124,7 @@ const int IMAGES = 50; ...@@ -124,7 +124,7 @@ const int IMAGES = 50;
@immutable @immutable
class MyApp extends StatelessWidget { class MyApp extends StatelessWidget {
const MyApp(this.port); const MyApp(this.port, {Key? key}) : super(key: key);
final int port; final int port;
......
...@@ -197,6 +197,8 @@ class CalculationManager { ...@@ -197,6 +197,8 @@ class CalculationManager {
// This is a StatefulWidget in order to hold the CalculationManager and // This is a StatefulWidget in order to hold the CalculationManager and
// the AnimationController for the running animation. // the AnimationController for the running animation.
class IsolateExampleWidget extends StatefulWidget { class IsolateExampleWidget extends StatefulWidget {
const IsolateExampleWidget({Key? key}) : super(key: key);
@override @override
IsolateExampleState createState() => IsolateExampleState(); IsolateExampleState createState() => IsolateExampleState();
} }
...@@ -302,5 +304,5 @@ class IsolateExampleState extends State<StatefulWidget> with SingleTickerProvide ...@@ -302,5 +304,5 @@ class IsolateExampleState extends State<StatefulWidget> with SingleTickerProvide
} }
void main() { void main() {
runApp(MaterialApp(home: IsolateExampleWidget())); runApp(const MaterialApp(home: IsolateExampleWidget()));
} }
...@@ -9,7 +9,7 @@ import '../widgets/gestures.dart'; ...@@ -9,7 +9,7 @@ import '../widgets/gestures.dart';
void main() { void main() {
testWidgets('Tap on center change color', (WidgetTester tester) async { testWidgets('Tap on center change color', (WidgetTester tester) async {
await tester.pumpWidget(Directionality( await tester.pumpWidget(const Directionality(
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
child: GestureDemo(), child: GestureDemo(),
)); ));
......
...@@ -13,6 +13,6 @@ void main() { ...@@ -13,6 +13,6 @@ void main() {
}); });
testWidgets('Sector Sixes', (WidgetTester tester) async { testWidgets('Sector Sixes', (WidgetTester tester) async {
await tester.pumpWidget(SectorApp()); await tester.pumpWidget(const SectorApp());
}); });
} }
...@@ -55,6 +55,8 @@ class _GesturePainter extends CustomPainter { ...@@ -55,6 +55,8 @@ class _GesturePainter extends CustomPainter {
} }
class GestureDemo extends StatefulWidget { class GestureDemo extends StatefulWidget {
const GestureDemo({Key? key}) : super(key: key);
@override @override
GestureDemoState createState() => GestureDemoState(); GestureDemoState createState() => GestureDemoState();
} }
...@@ -223,7 +225,7 @@ void main() { ...@@ -223,7 +225,7 @@ void main() {
theme: ThemeData.dark(), theme: ThemeData.dark(),
home: Scaffold( home: Scaffold(
appBar: AppBar(title: const Text('Gestures Demo')), appBar: AppBar(title: const Text('Gestures Demo')),
body: GestureDemo(), body: const GestureDemo(),
), ),
)); ));
} }
...@@ -16,6 +16,8 @@ RenderBoxToRenderSectorAdapter initCircle() { ...@@ -16,6 +16,8 @@ RenderBoxToRenderSectorAdapter initCircle() {
} }
class SectorApp extends StatefulWidget { class SectorApp extends StatefulWidget {
const SectorApp({Key? key}) : super(key: key);
@override @override
SectorAppState createState() => SectorAppState(); SectorAppState createState() => SectorAppState();
} }
...@@ -163,5 +165,5 @@ class SectorAppState extends State<SectorApp> { ...@@ -163,5 +165,5 @@ class SectorAppState extends State<SectorApp> {
} }
void main() { void main() {
runApp(SectorApp()); runApp(const SectorApp());
} }
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
class SpinningSquare extends StatefulWidget { class SpinningSquare extends StatefulWidget {
const SpinningSquare({Key? key}) : super(key: key);
@override @override
_SpinningSquareState createState() => _SpinningSquareState(); _SpinningSquareState createState() => _SpinningSquareState();
} }
...@@ -44,5 +46,5 @@ class _SpinningSquareState extends State<SpinningSquare> with SingleTickerProvid ...@@ -44,5 +46,5 @@ class _SpinningSquareState extends State<SpinningSquare> with SingleTickerProvid
} }
void main() { void main() {
runApp(Center(child: SpinningSquare())); runApp(const Center(child: SpinningSquare()));
} }
...@@ -58,6 +58,8 @@ Widget toStyledText(String name, String text) { ...@@ -58,6 +58,8 @@ Widget toStyledText(String name, String text) {
Widget toPlainText(String name, String text) => Text(name + ':' + text); Widget toPlainText(String name, String text) => Text(name + ':' + text);
class SpeakerSeparator extends StatelessWidget { class SpeakerSeparator extends StatelessWidget {
const SpeakerSeparator({Key? key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
...@@ -73,6 +75,8 @@ class SpeakerSeparator extends StatelessWidget { ...@@ -73,6 +75,8 @@ class SpeakerSeparator extends StatelessWidget {
} }
class StyledTextDemo extends StatefulWidget { class StyledTextDemo extends StatefulWidget {
const StyledTextDemo({Key? key}) : super(key: key);
@override @override
_StyledTextDemoState createState() => _StyledTextDemoState(); _StyledTextDemoState createState() => _StyledTextDemoState();
} }
...@@ -99,7 +103,7 @@ class _StyledTextDemoState extends State<StyledTextDemo> { ...@@ -99,7 +103,7 @@ class _StyledTextDemoState extends State<StyledTextDemo> {
.map<Widget>((List<String> nameAndText) => _toText(nameAndText[0], nameAndText[1])) .map<Widget>((List<String> nameAndText) => _toText(nameAndText[0], nameAndText[1]))
.expand((Widget line) => <Widget>[ .expand((Widget line) => <Widget>[
line, line,
SpeakerSeparator(), const SpeakerSeparator(),
]) ])
.toList()..removeLast(), .toList()..removeLast(),
), ),
...@@ -117,7 +121,7 @@ void main() { ...@@ -117,7 +121,7 @@ void main() {
), ),
body: Material( body: Material(
color: Colors.grey.shade50, color: Colors.grey.shade50,
child: StyledTextDemo(), child: const StyledTextDemo(),
), ),
), ),
)); ));
......
...@@ -8,6 +8,8 @@ import 'package:flutter/material.dart'; ...@@ -8,6 +8,8 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
class PlatformChannel extends StatefulWidget { class PlatformChannel extends StatefulWidget {
const PlatformChannel({Key? key}) : super(key: key);
@override @override
_PlatformChannelState createState() => _PlatformChannelState(); _PlatformChannelState createState() => _PlatformChannelState();
} }
...@@ -80,5 +82,5 @@ class _PlatformChannelState extends State<PlatformChannel> { ...@@ -80,5 +82,5 @@ class _PlatformChannelState extends State<PlatformChannel> {
} }
void main() { void main() {
runApp(MaterialApp(home: PlatformChannel())); runApp(const MaterialApp(home: PlatformChannel()));
} }
...@@ -8,6 +8,8 @@ import 'package:flutter/material.dart'; ...@@ -8,6 +8,8 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
class PlatformChannel extends StatefulWidget { class PlatformChannel extends StatefulWidget {
const PlatformChannel({Key? key}) : super(key: key);
@override @override
_PlatformChannelState createState() => _PlatformChannelState(); _PlatformChannelState createState() => _PlatformChannelState();
} }
...@@ -80,5 +82,5 @@ class _PlatformChannelState extends State<PlatformChannel> { ...@@ -80,5 +82,5 @@ class _PlatformChannelState extends State<PlatformChannel> {
} }
void main() { void main() {
runApp(MaterialApp(home: PlatformChannel())); runApp(const MaterialApp(home: PlatformChannel()));
} }
...@@ -8,10 +8,12 @@ import 'package:flutter/material.dart'; ...@@ -8,10 +8,12 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
void main() { void main() {
runApp(PlatformView()); runApp(const PlatformView());
} }
class PlatformView extends StatelessWidget { class PlatformView extends StatelessWidget {
const PlatformView({Key? key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return MaterialApp( return MaterialApp(
......
...@@ -123,6 +123,7 @@ class NavigationRail extends StatefulWidget { ...@@ -123,6 +123,7 @@ class NavigationRail extends StatefulWidget {
/// ///
/// Typically used within a [Row] that defines the [Scaffold.body] property. /// Typically used within a [Row] that defines the [Scaffold.body] property.
const NavigationRail({ const NavigationRail({
Key? key,
this.backgroundColor, this.backgroundColor,
this.extended = false, this.extended = false,
this.leading, this.leading,
...@@ -147,7 +148,8 @@ class NavigationRail extends StatefulWidget { ...@@ -147,7 +148,8 @@ class NavigationRail extends StatefulWidget {
assert(minExtendedWidth == null || minExtendedWidth > 0), assert(minExtendedWidth == null || minExtendedWidth > 0),
assert((minWidth == null || minExtendedWidth == null) || minExtendedWidth >= minWidth), assert((minWidth == null || minExtendedWidth == null) || minExtendedWidth >= minWidth),
assert(extended != null), assert(extended != null),
assert(!extended || (labelType == null || labelType == NavigationRailLabelType.none)); assert(!extended || (labelType == null || labelType == NavigationRailLabelType.none)),
super(key: key);
/// Sets the color of the Container that holds all of the [NavigationRail]'s /// Sets the color of the Container that holds all of the [NavigationRail]'s
/// contents. /// contents.
......
...@@ -494,7 +494,7 @@ class RtlOverrideWidgetsLocalization implements WidgetsLocalizations { ...@@ -494,7 +494,7 @@ class RtlOverrideWidgetsLocalization implements WidgetsLocalizations {
} }
class KeepsStateTestWidget extends StatefulWidget { class KeepsStateTestWidget extends StatefulWidget {
const KeepsStateTestWidget({this.navigatorKey}); const KeepsStateTestWidget({Key? key, this.navigatorKey}) : super(key: key);
final Key? navigatorKey; final Key? navigatorKey;
......
...@@ -960,7 +960,7 @@ Widget buildNavigator({ ...@@ -960,7 +960,7 @@ Widget buildNavigator({
} }
class KeepsStateTestWidget extends StatefulWidget { class KeepsStateTestWidget extends StatefulWidget {
const KeepsStateTestWidget({this.navigatorKey}); const KeepsStateTestWidget({Key? key, this.navigatorKey}) : super(key: key);
final Key? navigatorKey; final Key? navigatorKey;
......
...@@ -3308,7 +3308,7 @@ void main() { ...@@ -3308,7 +3308,7 @@ void main() {
}); });
testWidgets('Crash on dispose', (WidgetTester tester) async { testWidgets('Crash on dispose', (WidgetTester tester) async {
await tester.pumpWidget(Padding(padding: const EdgeInsets.only(right: 200.0), child: TabBarDemo())); await tester.pumpWidget(const Padding(padding: EdgeInsets.only(right: 200.0), child: TabBarDemo()));
await tester.tap(find.byIcon(Icons.directions_bike)); await tester.tap(find.byIcon(Icons.directions_bike));
// There was a time where this would throw an exception // There was a time where this would throw an exception
// because we tried to send a notification on dispose. // because we tried to send a notification on dispose.
...@@ -3428,6 +3428,8 @@ class _KeepAliveInkState extends State<KeepAliveInk> with AutomaticKeepAliveClie ...@@ -3428,6 +3428,8 @@ class _KeepAliveInkState extends State<KeepAliveInk> with AutomaticKeepAliveClie
} }
class TabBarDemo extends StatelessWidget { class TabBarDemo extends StatelessWidget {
const TabBarDemo({Key? key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return MaterialApp( return MaterialApp(
......
...@@ -1667,7 +1667,7 @@ class DependentState extends State<DependentStatefulWidget> { ...@@ -1667,7 +1667,7 @@ class DependentState extends State<DependentStatefulWidget> {
} }
class SwapKeyWidget extends StatefulWidget { class SwapKeyWidget extends StatefulWidget {
const SwapKeyWidget({this.childKey}): super(); const SwapKeyWidget({Key? key, this.childKey}): super(key: key);
final Key? childKey; final Key? childKey;
@override @override
......
...@@ -270,7 +270,7 @@ enum WidgetState { ...@@ -270,7 +270,7 @@ enum WidgetState {
} }
class TestStates extends StatefulWidget { class TestStates extends StatefulWidget {
const TestStates({required this.states}); const TestStates({Key? key, required this.states}) : super(key: key);
final List<WidgetState> states; final List<WidgetState> states;
......
...@@ -1030,13 +1030,13 @@ Route<void> _routeBuilder(BuildContext context, Object? arguments) { ...@@ -1030,13 +1030,13 @@ Route<void> _routeBuilder(BuildContext context, Object? arguments) {
Route<void> _routeFutureBuilder(BuildContext context, Object? arguments) { Route<void> _routeFutureBuilder(BuildContext context, Object? arguments) {
return MaterialPageRoute<void>( return MaterialPageRoute<void>(
builder: (BuildContext context) { builder: (BuildContext context) {
return RouteFutureWidget(); return const RouteFutureWidget();
}, },
); );
} }
class PagedTestWidget extends StatelessWidget { class PagedTestWidget extends StatelessWidget {
const PagedTestWidget({this.restorationId = 'app'}); const PagedTestWidget({Key? key, this.restorationId = 'app'}) : super(key: key);
final String restorationId; final String restorationId;
...@@ -1044,7 +1044,7 @@ class PagedTestWidget extends StatelessWidget { ...@@ -1044,7 +1044,7 @@ class PagedTestWidget extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return RootRestorationScope( return RootRestorationScope(
restorationId: restorationId, restorationId: restorationId,
child: Directionality( child: const Directionality(
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
child: PagedTestNavigator(), child: PagedTestNavigator(),
), ),
...@@ -1053,6 +1053,8 @@ class PagedTestWidget extends StatelessWidget { ...@@ -1053,6 +1053,8 @@ class PagedTestWidget extends StatelessWidget {
} }
class PagedTestNavigator extends StatefulWidget { class PagedTestNavigator extends StatefulWidget {
const PagedTestNavigator({Key? key}) : super(key: key);
@override @override
State<PagedTestNavigator> createState() => PagedTestNavigatorState(); State<PagedTestNavigator> createState() => PagedTestNavigatorState();
} }
...@@ -1157,7 +1159,7 @@ class TestPage extends Page<void> { ...@@ -1157,7 +1159,7 @@ class TestPage extends Page<void> {
} }
class TestWidget extends StatelessWidget { class TestWidget extends StatelessWidget {
const TestWidget({this.restorationId = 'app'}); const TestWidget({Key? key, this.restorationId = 'app'}) : super(key: key);
final String? restorationId; final String? restorationId;
...@@ -1237,6 +1239,8 @@ class RouteWidgetState extends State<RouteWidget> with RestorationMixin { ...@@ -1237,6 +1239,8 @@ class RouteWidgetState extends State<RouteWidget> with RestorationMixin {
} }
class RouteFutureWidget extends StatefulWidget { class RouteFutureWidget extends StatefulWidget {
const RouteFutureWidget({Key? key}): super(key: key);
@override @override
State<RouteFutureWidget> createState() => RouteFutureWidgetState(); State<RouteFutureWidget> createState() => RouteFutureWidgetState();
} }
......
...@@ -6,6 +6,8 @@ import 'package:flutter/material.dart'; ...@@ -6,6 +6,8 @@ import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
class TestPage extends StatelessWidget { class TestPage extends StatelessWidget {
const TestPage({Key? key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return MaterialApp( return MaterialApp(
...@@ -13,12 +15,14 @@ class TestPage extends StatelessWidget { ...@@ -13,12 +15,14 @@ class TestPage extends StatelessWidget {
theme: ThemeData( theme: ThemeData(
primarySwatch: Colors.blue, primarySwatch: Colors.blue,
), ),
home: HomePage(), home: const HomePage(),
); );
} }
} }
class HomePage extends StatefulWidget { class HomePage extends StatefulWidget {
const HomePage({Key? key}) : super(key: key);
@override @override
State<StatefulWidget> createState() => _HomePageState(); State<StatefulWidget> createState() => _HomePageState();
} }
...@@ -30,7 +34,7 @@ class _HomePageState extends State<HomePage> { ...@@ -30,7 +34,7 @@ class _HomePageState extends State<HomePage> {
barrierColor: Colors.black54, barrierColor: Colors.black54,
opaque: false, opaque: false,
pageBuilder: (BuildContext context, _, __) { pageBuilder: (BuildContext context, _, __) {
return ModalPage(); return const ModalPage();
}, },
)); ));
} }
...@@ -50,6 +54,8 @@ class _HomePageState extends State<HomePage> { ...@@ -50,6 +54,8 @@ class _HomePageState extends State<HomePage> {
} }
class ModalPage extends StatelessWidget { class ModalPage extends StatelessWidget {
const ModalPage({Key? key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Material( return Material(
...@@ -81,7 +87,7 @@ class ModalPage extends StatelessWidget { ...@@ -81,7 +87,7 @@ class ModalPage extends StatelessWidget {
void main() { void main() {
testWidgets('Barriers show when using PageRouteBuilder', (WidgetTester tester) async { testWidgets('Barriers show when using PageRouteBuilder', (WidgetTester tester) async {
await tester.pumpWidget(TestPage()); await tester.pumpWidget(const TestPage());
await tester.tap(find.byType(FloatingActionButton)); await tester.tap(find.byType(FloatingActionButton));
await tester.pumpAndSettle(); await tester.pumpAndSettle();
await expectLater( await expectLater(
......
...@@ -7,7 +7,7 @@ import 'package:flutter/gestures.dart'; ...@@ -7,7 +7,7 @@ import 'package:flutter/gestures.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
class ExpandingBox extends StatefulWidget { class ExpandingBox extends StatefulWidget {
const ExpandingBox({ required this.collapsedSize, required this.expandedSize }); const ExpandingBox({ Key? key, required this.collapsedSize, required this.expandedSize }) : super(key: key);
final double collapsedSize; final double collapsedSize;
final double expandedSize; final double expandedSize;
...@@ -220,12 +220,12 @@ void main() { ...@@ -220,12 +220,12 @@ void main() {
}); });
testWidgets('expanding page views', (WidgetTester tester) async { testWidgets('expanding page views', (WidgetTester tester) async {
await tester.pumpWidget(Padding(padding: const EdgeInsets.only(right: 200.0), child: TabBarDemo())); await tester.pumpWidget(const Padding(padding: EdgeInsets.only(right: 200.0), child: TabBarDemo()));
await tester.tap(find.text('bike')); await tester.tap(find.text('bike'));
await tester.pump(); await tester.pump();
await tester.pump(const Duration(seconds: 1)); await tester.pump(const Duration(seconds: 1));
final Rect bike1 = tester.getRect(find.byIcon(Icons.directions_bike)); final Rect bike1 = tester.getRect(find.byIcon(Icons.directions_bike));
await tester.pumpWidget(Padding(padding: EdgeInsets.zero, child: TabBarDemo())); await tester.pumpWidget(const Padding(padding: EdgeInsets.zero, child: TabBarDemo()));
final Rect bike2 = tester.getRect(find.byIcon(Icons.directions_bike)); final Rect bike2 = tester.getRect(find.byIcon(Icons.directions_bike));
expect(bike2.center, bike1.shift(const Offset(100.0, 0.0)).center); expect(bike2.center, bike1.shift(const Offset(100.0, 0.0)).center);
}); });
...@@ -266,6 +266,8 @@ void main() { ...@@ -266,6 +266,8 @@ void main() {
} }
class TabBarDemo extends StatelessWidget { class TabBarDemo extends StatelessWidget {
const TabBarDemo({Key? key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return MaterialApp( return MaterialApp(
......
...@@ -28,7 +28,7 @@ class Pair<T> { ...@@ -28,7 +28,7 @@ class Pair<T> {
/// and the other child in the bottom half. It will swap which child is on top /// and the other child in the bottom half. It will swap which child is on top
/// and which is on bottom every time the widget is rendered. /// and which is on bottom every time the widget is rendered.
abstract class Swapper extends RenderObjectWidget { abstract class Swapper extends RenderObjectWidget {
const Swapper({ this.stable, this.swapper }); const Swapper({ Key? key, this.stable, this.swapper }) : super(key: key);
final Widget? stable; final Widget? stable;
final Widget? swapper; final Widget? swapper;
...@@ -42,9 +42,10 @@ abstract class Swapper extends RenderObjectWidget { ...@@ -42,9 +42,10 @@ abstract class Swapper extends RenderObjectWidget {
class SwapperWithProperOverrides extends Swapper { class SwapperWithProperOverrides extends Swapper {
const SwapperWithProperOverrides({ const SwapperWithProperOverrides({
Key? key,
Widget? stable, Widget? stable,
Widget? swapper, Widget? swapper,
}) : super(stable: stable, swapper: swapper); }) : super(key: key, stable: stable, swapper: swapper);
@override @override
SwapperElement createElement() => SwapperElementWithProperOverrides(this); SwapperElement createElement() => SwapperElementWithProperOverrides(this);
...@@ -52,9 +53,10 @@ class SwapperWithProperOverrides extends Swapper { ...@@ -52,9 +53,10 @@ class SwapperWithProperOverrides extends Swapper {
class SwapperWithNoOverrides extends Swapper { class SwapperWithNoOverrides extends Swapper {
const SwapperWithNoOverrides({ const SwapperWithNoOverrides({
Key? key,
Widget? stable, Widget? stable,
Widget? swapper, Widget? swapper,
}) : super(stable: stable, swapper: swapper); }) : super(key: key, stable: stable, swapper: swapper);
@override @override
SwapperElement createElement() => SwapperElementWithNoOverrides(this); SwapperElement createElement() => SwapperElementWithNoOverrides(this);
...@@ -62,9 +64,10 @@ class SwapperWithNoOverrides extends Swapper { ...@@ -62,9 +64,10 @@ class SwapperWithNoOverrides extends Swapper {
class SwapperWithDeprecatedOverrides extends Swapper { class SwapperWithDeprecatedOverrides extends Swapper {
const SwapperWithDeprecatedOverrides({ const SwapperWithDeprecatedOverrides({
Key? key,
Widget? stable, Widget? stable,
Widget? swapper, Widget? swapper,
}) : super(stable: stable, swapper: swapper); }) : super(key: key, stable: stable, swapper: swapper);
@override @override
SwapperElement createElement() => SwapperElementWithDeprecatedOverrides(this); SwapperElement createElement() => SwapperElementWithDeprecatedOverrides(this);
......
...@@ -7,7 +7,7 @@ import 'package:flutter_test/flutter_test.dart'; ...@@ -7,7 +7,7 @@ import 'package:flutter_test/flutter_test.dart';
void main() { void main() {
testWidgets('widget moves scopes during restore', (WidgetTester tester) async { testWidgets('widget moves scopes during restore', (WidgetTester tester) async {
await tester.pumpWidget(RootRestorationScope( await tester.pumpWidget(const RootRestorationScope(
restorationId: 'root', restorationId: 'root',
child: Directionality( child: Directionality(
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
...@@ -111,6 +111,8 @@ void main() { ...@@ -111,6 +111,8 @@ void main() {
} }
class TestWidgetWithCounterChild extends StatefulWidget { class TestWidgetWithCounterChild extends StatefulWidget {
const TestWidgetWithCounterChild({Key? key}) : super(key: key);
@override @override
State<TestWidgetWithCounterChild> createState() => TestWidgetWithCounterChildState(); State<TestWidgetWithCounterChild> createState() => TestWidgetWithCounterChildState();
} }
...@@ -159,7 +161,7 @@ class TestWidgetWithCounterChildState extends State<TestWidgetWithCounterChild> ...@@ -159,7 +161,7 @@ class TestWidgetWithCounterChildState extends State<TestWidgetWithCounterChild>
} }
class Counter extends StatefulWidget { class Counter extends StatefulWidget {
const Counter({this.restorationId}); const Counter({Key? key, this.restorationId}) : super(key: key);
final String? restorationId; final String? restorationId;
...@@ -200,7 +202,7 @@ class CounterState extends State<Counter> with RestorationMixin { ...@@ -200,7 +202,7 @@ class CounterState extends State<Counter> with RestorationMixin {
} }
class TestWidget extends StatefulWidget { class TestWidget extends StatefulWidget {
const TestWidget({required this.restorationId}); const TestWidget({Key? key, required this.restorationId}) : super(key: key);
final String? restorationId; final String? restorationId;
......
...@@ -1658,7 +1658,7 @@ void main() { ...@@ -1658,7 +1658,7 @@ void main() {
testWidgets('child with local history can be disposed', (WidgetTester tester) async { testWidgets('child with local history can be disposed', (WidgetTester tester) async {
// Regression test: https://github.com/flutter/flutter/issues/52478 // Regression test: https://github.com/flutter/flutter/issues/52478
await tester.pumpWidget(MaterialApp( await tester.pumpWidget(const MaterialApp(
home: WidgetWithLocalHistory(), home: WidgetWithLocalHistory(),
)); ));
...@@ -1910,6 +1910,8 @@ class _TestDialogRouteWithCustomBarrierCurve<T> extends PopupRoute<T> { ...@@ -1910,6 +1910,8 @@ class _TestDialogRouteWithCustomBarrierCurve<T> extends PopupRoute<T> {
} }
class WidgetWithLocalHistory extends StatefulWidget { class WidgetWithLocalHistory extends StatefulWidget {
const WidgetWithLocalHistory({Key? key}) : super(key: key);
@override @override
WidgetWithLocalHistoryState createState() => WidgetWithLocalHistoryState(); WidgetWithLocalHistoryState createState() => WidgetWithLocalHistoryState();
} }
......
...@@ -116,7 +116,7 @@ void main() { ...@@ -116,7 +116,7 @@ void main() {
} }
class PageView62209 extends StatefulWidget { class PageView62209 extends StatefulWidget {
const PageView62209(); const PageView62209({Key? key}) : super(key: key);
@override @override
_PageView62209State createState() => _PageView62209State(); _PageView62209State createState() => _PageView62209State();
......
...@@ -169,7 +169,7 @@ Widget buildFrame({ ...@@ -169,7 +169,7 @@ Widget buildFrame({
} }
class SyncLoadTest extends StatefulWidget { class SyncLoadTest extends StatefulWidget {
const SyncLoadTest(); const SyncLoadTest({Key? key}) : super(key: key);
@override @override
SyncLoadTestState createState() => SyncLoadTestState(); SyncLoadTestState createState() => SyncLoadTestState();
......
...@@ -181,7 +181,7 @@ Widget _boilerplate(Widget child) { ...@@ -181,7 +181,7 @@ Widget _boilerplate(Widget child) {
} }
class SimpleCustomSemanticsWidget extends LeafRenderObjectWidget { class SimpleCustomSemanticsWidget extends LeafRenderObjectWidget {
const SimpleCustomSemanticsWidget(this.label); const SimpleCustomSemanticsWidget(this.label, {Key? key}) : super(key: key);
final String label; final String label;
......
...@@ -8,6 +8,8 @@ import 'package:flutter/scheduler.dart'; ...@@ -8,6 +8,8 @@ import 'package:flutter/scheduler.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
class CountButton extends StatefulWidget { class CountButton extends StatefulWidget {
const CountButton({Key? key}) : super(key: key);
@override @override
_CountButtonState createState() => _CountButtonState(); _CountButtonState createState() => _CountButtonState();
} }
...@@ -28,6 +30,8 @@ class _CountButtonState extends State<CountButton> { ...@@ -28,6 +30,8 @@ class _CountButtonState extends State<CountButton> {
} }
class AnimateSample extends StatefulWidget { class AnimateSample extends StatefulWidget {
const AnimateSample({Key? key}) : super(key: key);
@override @override
_AnimateSampleState createState() => _AnimateSampleState(); _AnimateSampleState createState() => _AnimateSampleState();
} }
...@@ -62,7 +66,7 @@ class _AnimateSampleState extends State<AnimateSample> ...@@ -62,7 +66,7 @@ class _AnimateSampleState extends State<AnimateSample>
void main() { void main() {
test('Test pump on LiveWidgetController', () async { test('Test pump on LiveWidgetController', () async {
runApp(MaterialApp(home: Center(child: CountButton()))); runApp(const MaterialApp(home: Center(child: CountButton())));
await SchedulerBinding.instance!.endOfFrame; await SchedulerBinding.instance!.endOfFrame;
final WidgetController controller = final WidgetController controller =
...@@ -76,7 +80,7 @@ void main() { ...@@ -76,7 +80,7 @@ void main() {
}); });
test('Test pumpAndSettle on LiveWidgetController', () async { test('Test pumpAndSettle on LiveWidgetController', () async {
runApp(MaterialApp(home: Center(child: AnimateSample()))); runApp(const MaterialApp(home: Center(child: AnimateSample())));
await SchedulerBinding.instance!.endOfFrame; await SchedulerBinding.instance!.endOfFrame;
final WidgetController controller = final WidgetController controller =
LiveWidgetController(WidgetsBinding.instance!); LiveWidgetController(WidgetsBinding.instance!);
......
...@@ -7,9 +7,11 @@ import 'package:flutter/material.dart'; ...@@ -7,9 +7,11 @@ import 'package:flutter/material.dart';
// ignore_for_file: public_member_api_docs // ignore_for_file: public_member_api_docs
void startApp() => runApp(MyApp()); void startApp() => runApp(const MyApp());
class MyApp extends StatefulWidget { class MyApp extends StatefulWidget {
const MyApp({Key? key}) : super(key: key);
@override @override
_MyAppState createState() => _MyAppState(); _MyAppState createState() => _MyAppState();
} }
......
...@@ -7,9 +7,11 @@ import 'package:flutter/material.dart'; ...@@ -7,9 +7,11 @@ import 'package:flutter/material.dart';
// ignore_for_file: public_member_api_docs // ignore_for_file: public_member_api_docs
void startApp() => runApp(MyWebApp()); void startApp() => runApp(const MyWebApp());
class MyWebApp extends StatefulWidget { class MyWebApp extends StatefulWidget {
const MyWebApp({Key? key}) : super(key: key);
@override @override
_MyWebAppState createState() => _MyWebAppState(); _MyWebAppState createState() => _MyWebAppState();
} }
......
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