enable use_key_in_widget_constructors lint (#77032)

This commit is contained in:
Michael Goderbauer 2021-03-02 10:14:02 -08:00 committed by GitHub
parent 6ec9014298
commit 0f568298d8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
161 changed files with 644 additions and 335 deletions

View file

@ -168,8 +168,8 @@ linter:
- prefer_if_null_operators
- prefer_initializing_formals
- prefer_inlined_adds
# - prefer_int_literals # not yet tested
# - prefer_interpolation_to_compose_strings # 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 # doesn't work with raw strings, see https://github.com/dart-lang/linter/issues/2490
- prefer_is_empty
- prefer_is_not_empty
- prefer_is_not_operator
@ -220,7 +220,7 @@ linter:
# - use_function_type_syntax_for_parameters # not yet tested
# - use_if_null_to_convert_nulls_to_bools # not yet tested
- 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_named_constants # not yet yested
- use_raw_strings

View file

@ -7,13 +7,15 @@ import 'package:flutter/scheduler.dart' show timeDilation;
void main() {
runApp(
ComplexLayoutApp()
const ComplexLayoutApp()
);
}
enum ScrollMode { complex, tile }
class ComplexLayoutApp extends StatefulWidget {
const ComplexLayoutApp({Key key}) : super(key: key);
@override
ComplexLayoutAppState createState() => ComplexLayoutAppState();
@ -68,7 +70,7 @@ class TileScrollLayout extends StatelessWidget {
child: Material(
elevation: (index % 5 + 1).toDouble(),
color: Colors.white,
child: IconBar(),
child: const IconBar(),
),
);
},
@ -101,7 +103,7 @@ class ComplexLayoutState extends State<ComplexLayout> {
print('Pressed search');
},
),
TopBarMenu(),
const TopBarMenu(),
],
),
body: Column(
@ -118,7 +120,7 @@ class ComplexLayoutState extends State<ComplexLayout> {
},
),
),
BottomBar(),
const BottomBar(),
],
),
drawer: const GalleryDrawer(),
@ -127,6 +129,8 @@ class ComplexLayoutState extends State<ComplexLayout> {
}
class TopBarMenu extends StatelessWidget {
const TopBarMenu({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return PopupMenuButton<String>(
@ -178,7 +182,7 @@ class TopBarMenu 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 String title;
@ -209,15 +213,15 @@ class FancyImageItem extends StatelessWidget {
return ListBody(
children: <Widget>[
UserHeader('Ali Connors $index'),
ItemDescription(),
ItemImageBox(),
InfoBar(),
const ItemDescription(),
const ItemImageBox(),
const InfoBar(),
const Padding(
padding: EdgeInsets.symmetric(horizontal: 8.0),
child: Divider(),
),
IconBar(),
FatDivider(),
const IconBar(),
const FatDivider(),
],
);
}
@ -233,19 +237,21 @@ class FancyGalleryItem extends StatelessWidget {
children: <Widget>[
const UserHeader('Ali Connors'),
ItemGalleryBox(index),
InfoBar(),
const InfoBar(),
const Padding(
padding: EdgeInsets.symmetric(horizontal: 8.0),
child: Divider(),
),
IconBar(),
FatDivider(),
const IconBar(),
const FatDivider(),
],
);
}
}
class InfoBar extends StatelessWidget {
const InfoBar({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Padding(
@ -262,6 +268,8 @@ class InfoBar extends StatelessWidget {
}
class IconBar extends StatelessWidget {
const IconBar({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Padding(
@ -279,7 +287,7 @@ class IconBar 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 String title;
@ -300,7 +308,7 @@ class IconWithText 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 String title;
@ -329,6 +337,8 @@ class MiniIconWithText extends StatelessWidget {
}
class FatDivider extends StatelessWidget {
const FatDivider({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
@ -339,7 +349,7 @@ class FatDivider extends StatelessWidget {
}
class UserHeader extends StatelessWidget {
const UserHeader(this.userName);
const UserHeader(this.userName, {Key key}) : super(key: key);
final String userName;
@ -380,7 +390,7 @@ class UserHeader extends StatelessWidget {
],
),
),
TopBarMenu(),
const TopBarMenu(),
],
),
);
@ -388,6 +398,8 @@ class UserHeader extends StatelessWidget {
}
class ItemDescription extends StatelessWidget {
const ItemDescription({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return const Padding(
@ -398,6 +410,8 @@ class ItemDescription extends StatelessWidget {
}
class ItemImageBox extends StatelessWidget {
const ItemImageBox({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Padding(
@ -477,7 +491,7 @@ class ItemImageBox extends StatelessWidget {
}
class ItemGalleryBox extends StatelessWidget {
const ItemGalleryBox(this.index);
const ItemGalleryBox(this.index, {Key key}) : super(key: key);
final int index;
@ -548,6 +562,8 @@ class ItemGalleryBox extends StatelessWidget {
}
class BottomBar extends StatelessWidget {
const BottomBar({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
@ -574,7 +590,7 @@ class BottomBar 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 String title;
@ -618,7 +634,7 @@ class GalleryDrawer extends StatelessWidget {
key: const PageStorageKey<String>('gallery-drawer'),
padding: EdgeInsets.zero,
children: <Widget>[
FancyDrawerHeader(),
const FancyDrawerHeader(),
ListTile(
key: const Key('scroll-switcher'),
title: const Text('Scroll Mode'),
@ -668,6 +684,8 @@ class GalleryDrawer extends StatelessWidget {
}
class FancyDrawerHeader extends StatelessWidget {
const FancyDrawerHeader({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(

View file

@ -27,7 +27,7 @@ Future<void> main() async {
ready.complete();
},
behavior: HitTestBehavior.opaque,
child: IgnorePointer(
child: const IgnorePointer(
ignoring: true,
child: ComplexLayoutApp(),
),
@ -45,7 +45,7 @@ Future<void> main() async {
// remove onTap handler, enable pointer events for app
runApp(GestureDetector(
child: IgnorePointer(
child: const IgnorePointer(
ignoring: false,
child: ComplexLayoutApp(),
),

View file

@ -29,7 +29,7 @@ const String kMacrobenchmarks = 'Macrobenchmarks';
void main() => runApp(const MacrobenchmarksApp());
class MacrobenchmarksApp extends StatelessWidget {
const MacrobenchmarksApp({this.initialRoute = '/'});
const MacrobenchmarksApp({Key key, this.initialRoute = '/'}) : super(key: key);
@override
Widget build(BuildContext context) {
@ -37,25 +37,25 @@ class MacrobenchmarksApp extends StatelessWidget {
title: kMacrobenchmarks,
initialRoute: initialRoute,
routes: <String, WidgetBuilder>{
'/': (BuildContext context) => HomePage(),
kCullOpacityRouteName: (BuildContext context) => CullOpacityPage(),
kCubicBezierRouteName: (BuildContext context) => CubicBezierPage(),
kBackdropFilterRouteName: (BuildContext context) => BackdropFilterPage(),
kPostBackdropFilterRouteName: (BuildContext context) => PostBackdropFilterPage(),
kSimpleAnimationRouteName: (BuildContext context) => SimpleAnimationPage(),
kPictureCacheRouteName: (BuildContext context) => PictureCachePage(),
kLargeImageChangerRouteName: (BuildContext context) => LargeImageChangerPage(),
kLargeImagesRouteName: (BuildContext context) => LargeImagesPage(),
kTextRouteName: (BuildContext context) => TextPage(),
kFullscreenTextRouteName: (BuildContext context) => TextFieldPage(),
kAnimatedPlaceholderRouteName: (BuildContext context) => AnimatedPlaceholderPage(),
kColorFilterAndFadeRouteName: (BuildContext context) => ColorFilterAndFadePage(),
'/': (BuildContext context) => const HomePage(),
kCullOpacityRouteName: (BuildContext context) => const CullOpacityPage(),
kCubicBezierRouteName: (BuildContext context) => const CubicBezierPage(),
kBackdropFilterRouteName: (BuildContext context) => const BackdropFilterPage(),
kPostBackdropFilterRouteName: (BuildContext context) => const PostBackdropFilterPage(),
kSimpleAnimationRouteName: (BuildContext context) => const SimpleAnimationPage(),
kPictureCacheRouteName: (BuildContext context) => const PictureCachePage(),
kLargeImageChangerRouteName: (BuildContext context) => const LargeImageChangerPage(),
kLargeImagesRouteName: (BuildContext context) => const LargeImagesPage(),
kTextRouteName: (BuildContext context) => const TextPage(),
kFullscreenTextRouteName: (BuildContext context) => const TextFieldPage(),
kAnimatedPlaceholderRouteName: (BuildContext context) => const AnimatedPlaceholderPage(),
kColorFilterAndFadeRouteName: (BuildContext context) => const ColorFilterAndFadePage(),
kFadingChildAnimationRouteName: (BuildContext context) => const FilteredChildAnimationPage(FilterType.opacity),
kImageFilteredTransformAnimationRouteName: (BuildContext context) => const FilteredChildAnimationPage(FilterType.rotateFilter),
kMultiWidgetConstructionRouteName: (BuildContext context) => const MultiWidgetConstructTable(10, 20),
kHeavyGridViewRouteName: (BuildContext context) => HeavyGridViewPage(),
kSimpleScrollRouteName: (BuildContext context) => SimpleScroll(),
kStackSizeRouteName: (BuildContext context) => StackSizePage(),
kHeavyGridViewRouteName: (BuildContext context) => const HeavyGridViewPage(),
kSimpleScrollRouteName: (BuildContext context) => const SimpleScroll(),
kStackSizeRouteName: (BuildContext context) => const StackSizePage(),
},
);
}
@ -64,6 +64,8 @@ class MacrobenchmarksApp extends StatelessWidget {
}
class HomePage extends StatelessWidget {
const HomePage({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(

View file

@ -24,6 +24,8 @@ const String kBlueSquare = 'iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAASEl'
/// A 10x10 grid of animated looping placeholder gifts that fade into a
/// blue square.
class AnimatedPlaceholderPage extends StatelessWidget {
const AnimatedPlaceholderPage({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return GridView.builder(

View file

@ -7,6 +7,8 @@ import 'dart:ui';
import 'package:flutter/material.dart';
class BackdropFilterPage extends StatefulWidget {
const BackdropFilterPage({Key key}) : super(key: key);
@override
_BackdropFilterPageState createState() => _BackdropFilterPageState();
}

View file

@ -9,6 +9,8 @@ import 'package:flutter/material.dart';
// This tests whether the Opacity layer raster cache works with color filters.
// See https://github.com/flutter/flutter/issues/51975.
class ColorFilterAndFadePage extends StatefulWidget {
const ColorFilterAndFadePage({Key key}) : super(key: key);
@override
_ColorFilterAndFadePageState createState() => _ColorFilterAndFadePageState();
}

View file

@ -8,6 +8,8 @@ import 'package:flutter/material.dart';
// Based on https://github.com/eseidelGoogle/bezier_perf/blob/master/lib/main.dart
class CubicBezierPage extends StatelessWidget {
const CubicBezierPage({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Center(
@ -22,7 +24,7 @@ class CubicBezierPage 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 double scale;
@ -91,7 +93,7 @@ class PathDetail {
}
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 double scale;

View file

@ -5,6 +5,8 @@
import 'package:flutter/material.dart';
class CullOpacityPage extends StatefulWidget {
const CullOpacityPage({Key key}) : super(key: key);
@override
State<StatefulWidget> createState() => _CullOpacityPageState();
}

View file

@ -12,10 +12,11 @@ enum FilterType {
}
class FilteredChildAnimationPage extends StatefulWidget {
const FilteredChildAnimationPage(this.initialFilterType, [
const FilteredChildAnimationPage(this.initialFilterType, {
Key key,
this.initialComplexChild = true,
this.initialUseRepaintBoundary = true,
]);
}) : super(key: key);
final FilterType initialFilterType;
final bool initialComplexChild;

View file

@ -48,6 +48,8 @@ const String textLotsOfText = 'Lorem ipsum dolor sit amet, consectetur '
'🦻 👃 🫀 🫁 🧠 🦷 🦴 👀 👁 👅 👄 💋 🩸';
class TextFieldPage extends StatelessWidget {
const TextFieldPage({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Material(

View file

@ -5,6 +5,8 @@
import 'package:flutter/material.dart';
class HeavyGridViewPage extends StatelessWidget {
const HeavyGridViewPage({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return GridView.builder(

View file

@ -8,6 +8,8 @@ import 'package:flutter/material.dart';
/// Displays a new (from image cache's perspective) large image every 500ms.
class LargeImageChangerPage extends StatefulWidget {
const LargeImageChangerPage({Key key}) : super(key: key);
@override
_LargeImageChangerState createState() => _LargeImageChangerState();
}

View file

@ -7,6 +7,8 @@ import 'dart:typed_data';
import 'package:flutter/material.dart';
class LargeImagesPage extends StatelessWidget {
const LargeImagesPage({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
final ImageCache imageCache = PaintingBinding.instance.imageCache;

View file

@ -5,6 +5,8 @@
import 'package:flutter/material.dart';
class PictureCachePage extends StatelessWidget {
const PictureCachePage({Key key}) : super(key: key);
static const List<String> kTabNames = <String>['1', '2', '3', '4', '5'];
@override

View file

@ -7,6 +7,8 @@ import 'dart:ui';
import 'package:flutter/material.dart';
class PostBackdropFilterPage extends StatefulWidget {
const PostBackdropFilterPage({Key key}) : super(key: key);
@override
_PostBackdropFilterPageState createState() => _PostBackdropFilterPageState();
}

View file

@ -5,6 +5,8 @@
import 'package:flutter/material.dart';
class SimpleAnimationPage extends StatelessWidget {
const SimpleAnimationPage({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return const Center(child: LinearProgressIndicator());

View file

@ -5,6 +5,8 @@
import 'package:flutter/material.dart';
class SimpleScroll extends StatelessWidget {
const SimpleScroll({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return ListView(

View file

@ -81,6 +81,8 @@ final GetStackPointerCallback getStackPointer = () {
}();
class StackSizePage extends StatelessWidget {
const StackSizePage({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Material(
@ -89,7 +91,7 @@ class StackSizePage extends StatelessWidget {
Container(
width: 200,
height: 100,
child: ParentWidget(),
child: const ParentWidget(),
),
],
),
@ -98,6 +100,8 @@ class StackSizePage extends StatelessWidget {
}
class ParentWidget extends StatelessWidget {
const ParentWidget({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
final int myStackSize = getStackPointer();

View file

@ -5,6 +5,8 @@
import 'package:flutter/material.dart';
class TextPage extends StatelessWidget {
const TextPage({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Material(

View file

@ -271,7 +271,7 @@ class BenchBuildColorsGrid extends WidgetBuildRecorder {
@override
Widget createWidget() {
_counter++;
return MaterialApp(home: ColorsDemo());
return const MaterialApp(home: ColorsDemo());
}
}
@ -469,6 +469,8 @@ class PaletteTabView extends StatelessWidget {
}
class ColorsDemo extends StatelessWidget {
const ColorsDemo({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return DefaultTabController(

View file

@ -84,7 +84,7 @@ class _MyHomePageState extends State<MyHomePage> {
}
class ProductPreview extends StatelessWidget {
const ProductPreview(this.previewIndex);
const ProductPreview(this.previewIndex, {Key key}) : super(key: key);
final int previewIndex;

View file

@ -17,7 +17,7 @@ void main() {
testWidgets(
'Frame Counter and Input Delay for benchmarkLive',
(WidgetTester tester) async {
await tester.pumpWidget(MaterialApp(home: Scaffold(body: SimpleScroll())));
await tester.pumpWidget(const MaterialApp(home: Scaffold(body: SimpleScroll())));
await tester.pumpAndSettle();
final Offset location = tester.getCenter(find.byType(ListView));
int frameCount = 0;

View file

@ -5,6 +5,8 @@
import 'package:flutter/material.dart';
class ButtonMatrixApp extends StatefulWidget {
const ButtonMatrixApp({Key key}) : super(key: key);
@override
ButtonMatrixAppState createState() => ButtonMatrixAppState();
}
@ -48,5 +50,5 @@ class ButtonMatrixAppState extends State<ButtonMatrixApp> {
}
void main() {
runApp(ButtonMatrixApp());
runApp(const ButtonMatrixApp());
}

View file

@ -13,7 +13,7 @@ void topMain() => runApp(const MyApp(Colors.green));
void bottomMain() => runApp(const MyApp(Colors.purple));
class MyApp extends StatelessWidget {
const MyApp(this.color);
const MyApp(this.color, {Key key}) : super(key: key);
final Color color;

View file

@ -20,6 +20,8 @@ import 'stock_symbol_viewer.dart';
import 'stock_types.dart';
class StocksApp extends StatefulWidget {
const StocksApp({Key key}) : super(key: key);
@override
StocksAppState createState() => StocksAppState();
}
@ -109,5 +111,5 @@ class StocksAppState extends State<StocksApp> {
}
void main() {
runApp(StocksApp());
runApp(const StocksApp());
}

View file

@ -52,7 +52,7 @@ class _NotImplementedDialog extends StatelessWidget {
}
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 StockConfiguration configuration;

View file

@ -7,7 +7,7 @@ import 'package:flutter/material.dart';
import 'stock_types.dart';
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 ValueChanged<StockConfiguration> updater;

View file

@ -65,7 +65,7 @@ class _StockSymbolView 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 StockData stocks;
@ -113,7 +113,7 @@ class StockSymbolPage extends StatelessWidget {
}
class StockSymbolBottomSheet extends StatelessWidget {
const StockSymbolBottomSheet({ this.stock });
const StockSymbolBottomSheet({ Key key, this.stock }) : super(key: key);
final Stock stock;

View file

@ -9,11 +9,13 @@ Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
const MethodChannel channel = MethodChannel('com.example.abstract_method_smoke_test');
await channel.invokeMethod<void>('show_keyboard');
runApp(MyApp());
runApp(const MyApp());
print('Test suceeded');
}
class MyApp extends StatelessWidget {
const MyApp({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
@ -21,12 +23,14 @@ class MyApp extends StatelessWidget {
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: HomePage(),
home: const HomePage(),
);
}
}
class HomePage extends StatefulWidget {
const HomePage({Key key}) : super(key: key);
@override
_HomePage createState() => _HomePage();
}
@ -40,7 +44,7 @@ class _HomePage extends State<HomePage> {
// https://github.com/flutter/flutter/issues/40126
WidgetsBinding.instance.addPostFrameCallback((_) async {
Navigator.of(context).push(
MaterialPageRoute<void>(builder: (_) => SecondPage()));
MaterialPageRoute<void>(builder: (_) => const SecondPage()));
});
}
@ -51,6 +55,8 @@ class _HomePage extends State<HomePage> {
}
class SecondPage extends StatelessWidget {
const SecondPage({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(

View file

@ -43,14 +43,14 @@ Future<String> dataHandler(String message) async {
}
Map<String, WidgetBuilder> routes = <String, WidgetBuilder>{
selectionControlsRoute : (BuildContext context) => SelectionControlsPage(),
popupControlsRoute : (BuildContext context) => PopupControlsPage(),
textFieldRoute : (BuildContext context) => TextFieldPage(),
headingsRoute: (BuildContext context) => HeadingsPage(),
selectionControlsRoute : (BuildContext context) => const SelectionControlsPage(),
popupControlsRoute : (BuildContext context) => const PopupControlsPage(),
textFieldRoute : (BuildContext context) => const TextFieldPage(),
headingsRoute: (BuildContext context) => const HeadingsPage(),
};
class TestApp extends StatelessWidget {
const TestApp();
const TestApp({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {

View file

@ -9,6 +9,8 @@ export 'controls_constants.dart';
/// A test page with a checkbox, three radio buttons, and a switch.
class SelectionControlsPage extends StatefulWidget {
const SelectionControlsPage({Key key}) : super(key: key);
@override
State<StatefulWidget> createState() => _SelectionControlsPageState();
}

View file

@ -9,6 +9,8 @@ export 'headings_constants.dart';
/// A test page with an app bar and some body text for testing heading flags.
class HeadingsPage extends StatelessWidget {
const HeadingsPage({Key key}) : super(key: key);
static const ValueKey<String> _appBarTitleKey = ValueKey<String>(appBarTitleKeyValue);
static const ValueKey<String> _bodyTextKey = ValueKey<String>(bodyTextKeyValue);

View file

@ -10,6 +10,8 @@ export 'popup_constants.dart';
/// A page with a popup menu, a dropdown menu, and a modal alert.
class PopupControlsPage extends StatefulWidget {
const PopupControlsPage({Key key}) : super(key: key);
@override
State<StatefulWidget> createState() => _PopupControlsPageState();
}

View file

@ -10,6 +10,8 @@ export 'text_field_constants.dart';
/// A page with a normal text field and a password field.
class TextFieldPage extends StatefulWidget {
const TextFieldPage({Key key}) : super(key: key);
@override
State<StatefulWidget> createState() => _TextFieldPageState();
}

View file

@ -16,10 +16,12 @@ final List<PageWidget> _allPages = <PageWidget>[
void main() {
enableFlutterDriverExtension(handler: driverDataHandler.handleMessage);
runApp(MaterialApp(home: Home()));
runApp(const MaterialApp(home: Home()));
}
class Home extends StatelessWidget {
const Home({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(

View file

@ -18,12 +18,12 @@ MethodChannel channel = const MethodChannel('android_views_integration');
const String kEventsFileName = 'touchEvents';
class MotionEventsPage extends PageWidget {
const MotionEventsPage()
: super('Motion Event Tests', const ValueKey<String>('MotionEventsListTile'));
const MotionEventsPage({Key key})
: super('Motion Event Tests', const ValueKey<String>('MotionEventsListTile'), key: key);
@override
Widget build(BuildContext context) {
return MotionEventsBody();
return const MotionEventsBody();
}
}
@ -44,6 +44,8 @@ class FutureDataHandler {
FutureDataHandler driverDataHandler = FutureDataHandler();
class MotionEventsBody extends StatefulWidget {
const MotionEventsBody({Key key}) : super(key: key);
@override
State createState() => MotionEventsBodyState();
}
@ -251,7 +253,7 @@ class MotionEventsBodyState extends State<MotionEventsBody> {
}
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> synthesizedEvent;

View file

@ -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.
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
///

View file

@ -10,14 +10,16 @@ import 'package:flutter/services.dart';
import 'page.dart';
class WindowManagerIntegrationsPage extends PageWidget {
const WindowManagerIntegrationsPage()
: super('Window Manager Integrations Tests', const ValueKey<String>('WmIntegrationsListTile'));
const WindowManagerIntegrationsPage({Key key})
: super('Window Manager Integrations Tests', const ValueKey<String>('WmIntegrationsListTile'), key: key);
@override
Widget build(BuildContext context) => WindowManagerBody();
Widget build(BuildContext context) => const WindowManagerBody();
}
class WindowManagerBody extends StatefulWidget {
const WindowManagerBody({Key key}) : super(key: key);
@override
State<WindowManagerBody> createState() => WindowManagerBodyState();
}

View file

@ -15,10 +15,12 @@ import 'src/test_step.dart';
void main() {
enableFlutterDriverExtension();
runApp(TestApp());
runApp(const TestApp());
}
class TestApp extends StatefulWidget {
const TestApp({Key key}) : super(key: key);
@override
_TestAppState createState() => _TestAppState();
}

View file

@ -11,10 +11,12 @@ import 'package:flutter_driver/driver_extension.dart';
void main() {
enableFlutterDriverExtension();
debugPrint('Application starting...');
runApp(MyApp());
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({Key key}) : super(key: key);
@override
State createState() => MyAppState();
}

View file

@ -8,10 +8,12 @@ import 'package:flutter_driver/driver_extension.dart';
void main() {
enableFlutterDriverExtension();
runApp(Center(child: Flavor()));
runApp(const Center(child: Flavor()));
}
class Flavor extends StatefulWidget {
const Flavor({Key key}) : super(key: key);
@override
_FlavorState createState() => _FlavorState();
}

View file

@ -138,7 +138,7 @@ class _CalculatorState extends State<Calculator> {
}
class CalcDisplay extends StatelessWidget {
const CalcDisplay({ this.content });
const CalcDisplay({ Key? key, this.content}) : super(key: key);
final String? content;
@ -154,7 +154,7 @@ class CalcDisplay extends StatelessWidget {
}
class KeyPad extends StatelessWidget {
const KeyPad({ this.calcState });
const KeyPad({ Key? key, this.calcState }) : super(key: key);
final _CalculatorState? calcState;
@ -222,7 +222,7 @@ class KeyPad extends StatelessWidget {
}
class KeyRow extends StatelessWidget {
const KeyRow(this.keys);
const KeyRow(this.keys, {Key? key}) : super(key: key);
final List<Widget> keys;
@ -238,7 +238,7 @@ class KeyRow 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 GestureTapCallback onTap;
@ -265,8 +265,8 @@ class CalcKey extends StatelessWidget {
}
class NumberKey extends CalcKey {
NumberKey(int value, _CalculatorState? calcState)
NumberKey(int value, _CalculatorState? calcState, {Key? key})
: super('$value', () {
calcState!.handleNumberTap(value);
});
}, key: key);
}

View file

@ -120,6 +120,8 @@ class PaletteTabView extends StatelessWidget {
}
class ColorsDemo extends StatelessWidget {
const ColorsDemo({Key? key}) : super(key: key);
static const String routeName = '/colors';
@override

View file

@ -86,6 +86,8 @@ class _ContactItem extends StatelessWidget {
}
class ContactsDemo extends StatefulWidget {
const ContactsDemo({Key? key}) : super(key: key);
static const String routeName = '/contacts';
@override

View file

@ -7,6 +7,8 @@ import 'package:flutter/cupertino.dart';
import '../../gallery/demo.dart';
class CupertinoProgressIndicatorDemo extends StatelessWidget {
const CupertinoProgressIndicatorDemo({Key? key}) : super(key: key);
static const String routeName = '/cupertino/progress_indicator';
@override

View file

@ -7,6 +7,8 @@ import 'package:flutter/cupertino.dart';
import '../../gallery/demo.dart';
class CupertinoAlertDemo extends StatefulWidget {
const CupertinoAlertDemo({Key? key}) : super(key: key);
static const String routeName = '/cupertino/alert';
@override

View file

@ -7,6 +7,8 @@ import 'package:flutter/cupertino.dart';
import '../../gallery/demo.dart';
class CupertinoButtonsDemo extends StatefulWidget {
const CupertinoButtonsDemo({Key? key}) : super(key: key);
static const String routeName = '/cupertino/buttons';
@override

View file

@ -32,13 +32,14 @@ const List<String> coolColorNames = <String>[
const int _kChildCount = 50;
class CupertinoNavigationDemo extends StatelessWidget {
CupertinoNavigationDemo({ this.randomSeed })
CupertinoNavigationDemo({ Key? key, this.randomSeed })
: colorItems = List<Color>.generate(_kChildCount, (int index) {
return coolColors[math.Random(randomSeed).nextInt(coolColors.length)];
}) ,
colorNameItems = List<String>.generate(_kChildCount, (int index) {
return coolColorNames[math.Random(randomSeed).nextInt(coolColorNames.length)];
});
}),
super(key: key);
static const String routeName = '/cupertino/navigation';
@ -85,12 +86,12 @@ class CupertinoNavigationDemo extends StatelessWidget {
);
case 1:
return CupertinoTabView(
builder: (BuildContext context) => CupertinoDemoTab2(),
builder: (BuildContext context) => const CupertinoDemoTab2(),
defaultTitle: 'Support Chat',
);
case 2:
return CupertinoTabView(
builder: (BuildContext context) => CupertinoDemoTab3(),
builder: (BuildContext context) => const CupertinoDemoTab3(),
defaultTitle: 'Account',
);
}
@ -104,7 +105,7 @@ class CupertinoNavigationDemo extends StatelessWidget {
}
class ExitButton extends StatelessWidget {
const ExitButton();
const ExitButton({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
@ -134,10 +135,11 @@ final Widget trailingButtons = Row(
class CupertinoDemoTab1 extends StatelessWidget {
const CupertinoDemoTab1({
Key? key,
this.colorItems,
this.colorNameItems,
this.randomSeed,
});
}) : super(key: key);
final List<Color>? colorItems;
final List<String>? colorNameItems;
@ -184,12 +186,13 @@ class CupertinoDemoTab1 extends StatelessWidget {
class Tab1RowItem extends StatelessWidget {
const Tab1RowItem({
Key? key,
this.index,
this.lastItem,
this.color,
this.colorName,
this.randomSeed,
});
}) : super(key: key);
final int? index;
final bool? lastItem;
@ -287,7 +290,7 @@ class Tab1RowItem extends StatelessWidget {
}
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 String? colorName;
@ -441,6 +444,8 @@ class Tab1ItemPageState extends State<Tab1ItemPage> {
}
class CupertinoDemoTab2 extends StatelessWidget {
const CupertinoDemoTab2({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return CupertinoPageScaffold(
@ -450,7 +455,7 @@ class CupertinoDemoTab2 extends StatelessWidget {
child: CupertinoScrollbar(
child: ListView(
children: <Widget>[
CupertinoUserInterfaceLevel(
const CupertinoUserInterfaceLevel(
data: CupertinoUserInterfaceLevelData.elevated,
child: Tab2Header(),
),
@ -463,6 +468,8 @@ class CupertinoDemoTab2 extends StatelessWidget {
}
class Tab2Header extends StatelessWidget {
const Tab2Header({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Padding(
@ -589,7 +596,7 @@ enum Tab2ConversationBubbleColor {
}
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 Tab2ConversationBubbleColor? color;
@ -633,7 +640,7 @@ class Tab2ConversationBubble 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 Color? color;
@ -672,7 +679,7 @@ class Tab2ConversationAvatar 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 String? text;
@ -742,6 +749,8 @@ List<Widget> buildTab2Conversation() {
}
class CupertinoDemoTab3 extends StatelessWidget {
const CupertinoDemoTab3({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return CupertinoPageScaffold(
@ -755,7 +764,7 @@ class CupertinoDemoTab3 extends StatelessWidget {
Navigator.of(context, rootNavigator: true).push(
CupertinoPageRoute<bool>(
fullscreenDialog: true,
builder: (BuildContext context) => Tab3Dialog(),
builder: (BuildContext context) => const Tab3Dialog(),
),
);
},
@ -792,6 +801,8 @@ class CupertinoDemoTab3 extends StatelessWidget {
}
class Tab3Dialog extends StatelessWidget {
const Tab3Dialog({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return CupertinoPageScaffold(

View file

@ -12,6 +12,8 @@ const double _kPickerSheetHeight = 216.0;
const double _kPickerItemHeight = 32.0;
class CupertinoPickerDemo extends StatefulWidget {
const CupertinoPickerDemo({Key? key}) : super(key: key);
static const String routeName = '/cupertino/picker';
@override

View file

@ -9,6 +9,8 @@ import 'package:flutter/cupertino.dart';
import '../../gallery/demo.dart';
class CupertinoRefreshControlDemo extends StatefulWidget {
const CupertinoRefreshControlDemo({Key? key}) : super(key: key);
static const String routeName = '/cupertino/refresh';
@override

View file

@ -12,6 +12,8 @@ const Color _kKeyPenumbraOpacity = Color(0x24000000); // alpha = 0.14
const Color _kAmbientShadowOpacity = Color(0x1F000000); // alpha = 0.12
class CupertinoSegmentedControlDemo extends StatefulWidget {
const CupertinoSegmentedControlDemo({Key? key}) : super(key: key);
static const String routeName = 'cupertino/segmented_control';
@override

View file

@ -7,6 +7,8 @@ import 'package:flutter/cupertino.dart';
import '../../gallery/demo.dart';
class CupertinoSliderDemo extends StatefulWidget {
const CupertinoSliderDemo({Key? key}) : super(key: key);
static const String routeName = '/cupertino/slider';
@override

View file

@ -7,6 +7,8 @@ import 'package:flutter/cupertino.dart';
import '../../gallery/demo.dart';
class CupertinoSwitchDemo extends StatefulWidget {
const CupertinoSwitchDemo({Key? key}) : super(key: key);
static const String routeName = '/cupertino/switch';
@override

View file

@ -5,6 +5,8 @@
import 'package:flutter/cupertino.dart';
class CupertinoTextFieldDemo extends StatefulWidget {
const CupertinoTextFieldDemo({Key? key}) : super(key: key);
static const String routeName = '/cupertino/text_fields';
@override

View file

@ -5,6 +5,8 @@
import 'package:flutter/material.dart';
class FortnightlyDemo extends StatelessWidget {
const FortnightlyDemo({Key? key}) : super(key: key);
static const String routeName = '/fortnightly';
@override
@ -15,7 +17,7 @@ class FortnightlyDemo extends StatelessWidget {
home: Scaffold(
body: Stack(
children: <Widget>[
FruitPage(),
const FruitPage(),
SafeArea(
child: ShortAppBar(
onBackPressed: () {
@ -31,7 +33,7 @@ class FortnightlyDemo extends StatelessWidget {
}
class ShortAppBar extends StatelessWidget {
const ShortAppBar({ this.onBackPressed });
const ShortAppBar({ Key? key, this.onBackPressed }) : super(key: key);
final VoidCallback? onBackPressed;
@ -66,6 +68,8 @@ class ShortAppBar extends StatelessWidget {
}
class FruitPage extends StatelessWidget {
const FruitPage({Key? key}) : super(key: key);
static final String paragraph1 = '''
Have you ever held a quince? It's strange;
covered in a fuzz somewhere between peach skin and a spider web. And it's

View file

@ -7,6 +7,8 @@ import 'package:flutter/material.dart';
import '../gallery/demo.dart';
class ImagesDemo extends StatelessWidget {
const ImagesDemo({Key? key}) : super(key: key);
static const String routeName = '/images';
@override

View file

@ -239,6 +239,8 @@ class BackdropTitle extends AnimatedWidget {
// This widget is essentially the backdrop itself.
class BackdropDemo extends StatefulWidget {
const BackdropDemo({Key? key}) : super(key: key);
static const String routeName = '/material/backdrop';
@override

View file

@ -7,6 +7,8 @@ import 'package:flutter/material.dart';
import '../../gallery/demo.dart';
class BottomAppBarDemo extends StatefulWidget {
const BottomAppBarDemo({Key? key}) : super(key: key);
static const String routeName = '/material/bottom_app_bar';
@override

View file

@ -74,6 +74,8 @@ class NavigationIconView {
}
class CustomIcon extends StatelessWidget {
const CustomIcon({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
final IconThemeData iconTheme = IconTheme.of(context);
@ -87,6 +89,8 @@ class CustomIcon extends StatelessWidget {
}
class CustomInactiveIcon extends StatelessWidget {
const CustomInactiveIcon({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
final IconThemeData iconTheme = IconTheme.of(context);
@ -102,6 +106,8 @@ class CustomInactiveIcon extends StatelessWidget {
}
class BottomNavigationDemo extends StatefulWidget {
const BottomNavigationDemo({Key? key}) : super(key: key);
static const String routeName = '/material/bottom_navigation';
@override
@ -125,8 +131,8 @@ class _BottomNavigationDemoState extends State<BottomNavigationDemo>
vsync: this,
),
NavigationIconView(
activeIcon: CustomIcon(),
icon: CustomInactiveIcon(),
activeIcon: const CustomIcon(),
icon: const CustomInactiveIcon(),
title: 'Box',
color: Colors.deepOrange,
vsync: this,

View file

@ -46,6 +46,8 @@ const String _actionText =
const String _actionCode = 'buttons_action';
class ButtonsDemo extends StatefulWidget {
const ButtonsDemo({Key? key}) : super(key: key);
static const String routeName = '/material/buttons';
@override

View file

@ -335,6 +335,8 @@ class TravelDestinationContent extends StatelessWidget {
}
class CardsDemo extends StatefulWidget {
const CardsDemo({Key? key}) : super(key: key);
static const String routeName = '/material/cards';
@override

View file

@ -135,6 +135,8 @@ class _ChipsTile extends StatelessWidget {
}
class ChipDemo extends StatefulWidget {
const ChipDemo({Key? key}) : super(key: key);
static const String routeName = '/material/chip';
@override

View file

@ -142,6 +142,8 @@ class DessertDataSource extends DataTableSource {
}
class DataTableDemo extends StatefulWidget {
const DataTableDemo({Key? key}) : super(key: key);
static const String routeName = '/material/data-table';
@override

View file

@ -113,6 +113,8 @@ class _DateTimePicker extends StatelessWidget {
}
class DateAndTimePickerDemo extends StatefulWidget {
const DateAndTimePickerDemo({Key? key}) : super(key: key);
static const String routeName = '/material/date-and-time-pickers';
@override

View file

@ -48,6 +48,8 @@ class DialogDemoItem extends StatelessWidget {
}
class DialogDemo extends StatefulWidget {
const DialogDemo({Key? key}) : super(key: key);
static const String routeName = '/material/dialog';
@override
@ -192,7 +194,7 @@ class DialogDemoState extends State<DialogDemo> {
child: const Text('FULLSCREEN'),
onPressed: () {
Navigator.push(context, MaterialPageRoute<DismissDialogAction>(
builder: (BuildContext context) => FullScreenDialogDemo(),
builder: (BuildContext context) => const FullScreenDialogDemo(),
fullscreenDialog: true,
));
},

View file

@ -13,6 +13,8 @@ const String _kAsset2 = 'people/square/sandra.png';
const String _kGalleryAssetsPackage = 'flutter_gallery_assets';
class DrawerDemo extends StatefulWidget {
const DrawerDemo({Key? key}) : super(key: key);
static const String routeName = '/material/drawer';
@override

View file

@ -7,6 +7,8 @@ import 'package:flutter/material.dart';
import '../../gallery/demo.dart';
class ElevationDemo extends StatefulWidget {
const ElevationDemo({Key? key}) : super(key: key);
static const String routeName = '/material/elevation';
@override

View file

@ -18,11 +18,12 @@ typedef ValueToString<T> = String? Function(T value);
class DualHeaderWithHint extends StatelessWidget {
const DualHeaderWithHint({
Key? key,
this.name,
this.value,
this.hint,
this.showHint,
});
}) : super(key: key);
final String? name;
final String? value;
@ -80,11 +81,12 @@ class DualHeaderWithHint extends StatelessWidget {
class CollapsibleBody extends StatelessWidget {
const CollapsibleBody({
Key? key,
this.margin = EdgeInsets.zero,
this.child,
this.onSave,
this.onCancel,
});
}) : super(key: key);
final EdgeInsets margin;
final Widget? child;
@ -175,6 +177,8 @@ class DemoItem<T> {
}
class ExpansionPanelsDemo extends StatefulWidget {
const ExpansionPanelsDemo({Key? key}) : super(key: key);
static const String routeName = '/material/expansion_panels';
@override

View file

@ -7,6 +7,8 @@ import 'package:flutter/material.dart';
import '../../gallery/demo.dart';
class ExpansionTileListDemo extends StatelessWidget {
const ExpansionTileListDemo({Key? key}) : super(key: key);
static const String routeName = '/material/expansion-tile-list';
@override

View file

@ -93,6 +93,8 @@ class DateTimeItem extends StatelessWidget {
}
class FullScreenDialogDemo extends StatefulWidget {
const FullScreenDialogDemo({Key? key}) : super(key: key);
@override
FullScreenDialogDemoState createState() => FullScreenDialogDemoState();
}

View file

@ -7,6 +7,8 @@ import 'package:flutter/material.dart';
import '../../gallery/demo.dart';
class IconsDemo extends StatefulWidget {
const IconsDemo({Key? key}) : super(key: key);
static const String routeName = '/material/icons';
@override

View file

@ -7,6 +7,8 @@ import 'package:flutter/material.dart';
import '../../gallery/demo.dart';
class ModalBottomSheetDemo extends StatelessWidget {
const ModalBottomSheetDemo({Key? key}) : super(key: key);
static const String routeName = '/material/modal-bottom-sheet';
@override

View file

@ -74,6 +74,8 @@ class _PageSelector extends StatelessWidget {
}
class PageSelectorDemo extends StatelessWidget {
const PageSelectorDemo({Key? key}) : super(key: key);
static const String routeName = '/material/page-selector';
static final List<Icon> icons = <Icon>[
const Icon(Icons.event, semanticLabel: 'Event'),

View file

@ -7,6 +7,8 @@ import 'package:flutter/material.dart';
import '../../gallery/demo.dart';
class PersistentBottomSheetDemo extends StatefulWidget {
const PersistentBottomSheetDemo({Key? key}) : super(key: key);
static const String routeName = '/material/persistent-bottom-sheet';
@override

View file

@ -7,6 +7,8 @@ import 'package:flutter/material.dart';
import '../../gallery/demo.dart';
class ProgressIndicatorDemo extends StatefulWidget {
const ProgressIndicatorDemo({Key? key}) : super(key: key);
static const String routeName = '/material/progress-indicator';
@override

View file

@ -36,6 +36,8 @@ const List<_Page> _allPages = <_Page>[
];
class ScrollableTabsDemo extends StatefulWidget {
const ScrollableTabsDemo({Key? key}) : super(key: key);
static const String routeName = '/material/scrollable-tabs';
@override

View file

@ -7,6 +7,8 @@ import 'package:flutter/material.dart';
import '../../gallery/demo.dart';
class SearchDemo extends StatefulWidget {
const SearchDemo({Key? key}) : super(key: key);
static const String routeName = '/material/search';
@override

View file

@ -28,6 +28,8 @@ const String _switchText =
const String _switchCode = 'selectioncontrols_switch';
class SelectionControlsDemo extends StatefulWidget {
const SelectionControlsDemo({Key? key}) : super(key: key);
static const String routeName = '/material/selection-controls';
@override

View file

@ -9,6 +9,8 @@ import 'package:flutter/material.dart';
import '../../gallery/demo.dart';
class SliderDemo extends StatefulWidget {
const SliderDemo({Key? key}) : super(key: key);
static const String routeName = '/material/slider';
@override

View file

@ -138,6 +138,8 @@ class _CardDataItem extends StatelessWidget {
}
class TabsDemo extends StatelessWidget {
const TabsDemo({Key? key}) : super(key: key);
static const String routeName = '/material/tabs';
@override

View file

@ -35,6 +35,8 @@ final List<_Page> _allPages = <_Page>[
];
class TabsFabDemo extends StatefulWidget {
const TabsFabDemo({Key? key}) : super(key: key);
static const String routeName = '/material/tabs-fab';
@override

View file

@ -26,6 +26,7 @@ class PersonData {
class PasswordField extends StatefulWidget {
const PasswordField({
Key? key,
this.fieldKey,
this.hintText,
this.labelText,
@ -33,7 +34,7 @@ class PasswordField extends StatefulWidget {
this.onSaved,
this.validator,
this.onFieldSubmitted,
});
}) : super(key: key);
final Key? fieldKey;
final String? hintText;

View file

@ -12,6 +12,7 @@ const String _introText =
'apps accessible, like screen readers.';
class TooltipDemo extends StatelessWidget {
const TooltipDemo({Key? key}) : super(key: key);
static const String routeName = '/material/tooltips';

View file

@ -10,7 +10,7 @@ class PestoDemo extends StatelessWidget {
static const String routeName = '/pesto';
@override
Widget build(BuildContext context) => PestoHome();
Widget build(BuildContext context) => const PestoHome();
}
@ -29,6 +29,8 @@ final ThemeData _kTheme = ThemeData(
);
class PestoHome extends StatelessWidget {
const PestoHome({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return const RecipeGridPage(recipes: kPestoRecipes);
@ -36,6 +38,8 @@ class PestoHome extends StatelessWidget {
}
class PestoFavorites extends StatelessWidget {
const PestoFavorites({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return RecipeGridPage(recipes: _favoriteRecipes.toList());
@ -167,7 +171,7 @@ class _RecipeGridPageState extends State<RecipeGridPage> {
void showFavoritesPage(BuildContext context) {
Navigator.push(context, MaterialPageRoute<void>(
settings: const RouteSettings(name: '/pesto/favorites'),
builder: (BuildContext context) => PestoFavorites(),
builder: (BuildContext context) => const PestoFavorites(),
));
}
@ -185,7 +189,7 @@ class _RecipeGridPageState extends State<RecipeGridPage> {
}
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? t;

View file

@ -13,6 +13,8 @@ import 'package:flutter_gallery/demo/shrine/login.dart';
import 'package:flutter_gallery/demo/shrine/supplemental/cut_corners_border.dart';
class ShrineApp extends StatefulWidget {
const ShrineApp({Key? key}) : super(key: key);
@override
_ShrineAppState createState() => _ShrineAppState();
}
@ -62,7 +64,7 @@ Route<dynamic>? _getRoute(RouteSettings settings) {
return MaterialPageRoute<void>(
settings: settings,
builder: (BuildContext context) => LoginPage(),
builder: (BuildContext context) => const LoginPage(),
fullscreenDialog: true,
);
}

View file

@ -198,12 +198,13 @@ class _BackdropTitle extends AnimatedWidget {
/// front or back layer is showing.
class Backdrop extends StatefulWidget {
const Backdrop({
Key? key,
required this.frontLayer,
required this.backLayer,
required this.frontTitle,
required this.backTitle,
required this.controller,
});
}) : super(key: key);
final Widget frontLayer;
final Widget backLayer;
@ -355,7 +356,7 @@ class _BackdropState extends State<Backdrop> with SingleTickerProviderStateMixin
onPressed: () {
Navigator.push<void>(
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
onPressed: () {
Navigator.push<void>(
context,
MaterialPageRoute<void>(builder: (BuildContext context) => LoginPage()),
MaterialPageRoute<void>(builder: (BuildContext context) => const LoginPage()),
);
},
),

View file

@ -286,9 +286,9 @@ class _ExpandingBottomSheetState extends State<ExpandingBottomSheet> with Ticker
width: numProducts > 3 ? _width - 94.0 : _width - 64.0,
height: _kCartHeight,
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
Widget _buildShoppingCartPage() {
return Opacity(
opacity: _cartOpacityAnimation.value,
child: ShoppingCartPage(),
child: const ShoppingCartPage(),
);
}
@ -404,6 +404,8 @@ class _ExpandingBottomSheetState extends State<ExpandingBottomSheet> with Ticker
}
class ProductThumbnailRow extends StatefulWidget {
const ProductThumbnailRow({Key? key}) : super(key: key);
@override
_ProductThumbnailRowState createState() => _ProductThumbnailRowState();
}
@ -511,6 +513,8 @@ class _ProductThumbnailRowState extends State<ProductThumbnailRow> {
}
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
// more than three products in the cart. This calculates overflow products,
// including their duplicates (but not duplicates of products shown as
@ -554,7 +558,7 @@ class ExtraProductsNumber 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> opacityAnimation;

View file

@ -12,7 +12,7 @@ import 'package:flutter_gallery/demo/shrine/model/product.dart';
import 'package:flutter_gallery/demo/shrine/supplemental/asymmetric_view.dart';
class ProductPage extends StatelessWidget {
const ProductPage({this.category = Category.all});
const ProductPage({Key? key, this.category = Category.all}) : super(key: key);
final Category category;

View file

@ -7,6 +7,8 @@ import 'package:flutter/material.dart';
import 'package:flutter_gallery/demo/shrine/colors.dart';
class LoginPage extends StatefulWidget {
const LoginPage({Key? key}) : super(key: key);
@override
_LoginPageState createState() => _LoginPageState();
}

View file

@ -14,6 +14,8 @@ import 'package:flutter_gallery/demo/shrine/model/product.dart';
const double _leftColumnWidth = 60.0;
class ShoppingCartPage extends StatefulWidget {
const ShoppingCartPage({Key? key}) : super(key: key);
@override
_ShoppingCartPageState createState() => _ShoppingCartPageState();
}
@ -103,7 +105,7 @@ class _ShoppingCartPageState extends State<ShoppingCartPage> {
}
class ShoppingCartSummary extends StatelessWidget {
const ShoppingCartSummary({this.model});
const ShoppingCartSummary({Key? key, this.model}) : super(key: key);
final AppStateModel? model;
@ -183,10 +185,11 @@ class ShoppingCartSummary extends StatelessWidget {
class ShoppingCartRow extends StatelessWidget {
const ShoppingCartRow({
Key? key,
required this.product,
required this.quantity,
this.onPressed,
});
}) : super(key: key);
final Product product;
final int? quantity;

View file

@ -10,8 +10,8 @@ import 'package:flutter_gallery/demo/shrine/model/app_state_model.dart';
import 'package:flutter_gallery/demo/shrine/model/product.dart';
class ProductCard extends StatelessWidget {
const ProductCard({ this.imageAspectRatio = 33 / 49, this.product })
: assert(imageAspectRatio > 0);
const ProductCard({ Key? key, this.imageAspectRatio = 33 / 49, this.product })
: assert(imageAspectRatio > 0), super(key: key);
final double imageAspectRatio;
final Product? product;

View file

@ -9,9 +9,10 @@ import 'package:flutter_gallery/demo/shrine/supplemental/product_card.dart';
class TwoProductCardColumn extends StatelessWidget {
const TwoProductCardColumn({
Key? key,
required this.bottom,
this.top,
});
}) : super(key: key);
final Product? bottom, top;
@ -57,7 +58,7 @@ class TwoProductCardColumn extends StatelessWidget {
}
class OneProductCardColumn extends StatelessWidget {
const OneProductCardColumn({this.product});
const OneProductCardColumn({Key? key, this.product}) : super(key: key);
final Product? product;

View file

@ -11,5 +11,5 @@ class ShrineDemo extends StatelessWidget {
static const String routeName = '/shrine'; // Used by the Gallery app.
@override
Widget build(BuildContext context) => ShrineApp();
Widget build(BuildContext context) => const ShrineApp();
}

View file

@ -8,10 +8,11 @@ import 'package:flutter/material.dart';
@immutable
class ColorPicker extends StatelessWidget {
const ColorPicker({
Key? key,
required this.colors,
required this.selectedColor,
this.onColorSelection,
});
}) : super(key: key);
final Set<Color> colors;
final Color selectedColor;

View file

@ -39,6 +39,8 @@ class TextStyleItem extends StatelessWidget {
}
class TypographyDemo extends StatelessWidget {
const TypographyDemo({Key? key}) : super(key: key);
static const String routeName = '/typography';
@override

View file

@ -92,7 +92,7 @@ class VideoCard extends StatelessWidget {
}
class VideoPlayerLoading extends StatefulWidget {
const VideoPlayerLoading(this.controller);
const VideoPlayerLoading(this.controller, {Key? key}) : super(key: key);
final VideoPlayerController? controller;
@ -136,7 +136,7 @@ class _VideoPlayerLoadingState extends State<VideoPlayerLoading> {
}
class VideoPlayPause extends StatefulWidget {
const VideoPlayPause(this.controller);
const VideoPlayPause(this.controller, {Key? key}) : super(key: key);
final VideoPlayerController? controller;
@ -202,9 +202,10 @@ class _VideoPlayPauseState extends State<VideoPlayPause> {
class FadeAnimation extends StatefulWidget {
const FadeAnimation({
Key? key,
this.child,
this.duration = const Duration(milliseconds: 500),
});
}) : super(key: key);
final Widget? child;
final Duration duration;
@ -264,9 +265,10 @@ class _FadeAnimationState extends State<FadeAnimation> with SingleTickerProvider
class ConnectivityOverlay extends StatefulWidget {
const ConnectivityOverlay({
Key? key,
this.child,
this.connectedCompleter,
});
}) : super(key: key);
final Widget? child;
final Completer<void>? connectedCompleter;

View file

@ -179,13 +179,14 @@ class _BackAppBar extends StatelessWidget {
class Backdrop extends StatefulWidget {
const Backdrop({
Key? key,
this.frontAction,
this.frontTitle,
this.frontHeading,
this.frontLayer,
this.backTitle,
this.backLayer,
});
}) : super(key: key);
final Widget? frontAction;
final Widget? frontTitle;

View file

@ -42,12 +42,13 @@ class ComponentDemoTabData {
class TabbedComponentDemoScaffold extends StatelessWidget {
const TabbedComponentDemoScaffold({
Key? key,
this.title,
this.demos,
this.actions,
this.isScrollable = true,
this.showExampleCodeAction = true,
});
}) : super(key: key);
final List<ComponentDemoTabData>? demos;
final String? title;
@ -147,7 +148,7 @@ class TabbedComponentDemoScaffold extends StatelessWidget {
}
class FullScreenCodeDialog extends StatefulWidget {
const FullScreenCodeDialog({ this.exampleCodeTag });
const FullScreenCodeDialog({ Key? key, this.exampleCodeTag }) : super(key: key);
final String? exampleCodeTag;

View file

@ -104,7 +104,7 @@ List<GalleryDemo> _buildGalleryDemos() {
icon: GalleryIcons.custom_typography,
category: _kDemos,
routeName: FortnightlyDemo.routeName,
buildRoute: (BuildContext context) => FortnightlyDemo(),
buildRoute: (BuildContext context) => const FortnightlyDemo(),
),
GalleryDemo(
title: 'Contact profile',
@ -112,7 +112,7 @@ List<GalleryDemo> _buildGalleryDemos() {
icon: GalleryIcons.account_box,
category: _kDemos,
routeName: ContactsDemo.routeName,
buildRoute: (BuildContext context) => ContactsDemo(),
buildRoute: (BuildContext context) => const ContactsDemo(),
),
GalleryDemo(
title: 'Animation',
@ -146,7 +146,7 @@ List<GalleryDemo> _buildGalleryDemos() {
icon: GalleryIcons.colors,
category: _kStyle,
routeName: ColorsDemo.routeName,
buildRoute: (BuildContext context) => ColorsDemo(),
buildRoute: (BuildContext context) => const ColorsDemo(),
),
GalleryDemo(
title: 'Typography',
@ -154,7 +154,7 @@ List<GalleryDemo> _buildGalleryDemos() {
icon: GalleryIcons.custom_typography,
category: _kStyle,
routeName: TypographyDemo.routeName,
buildRoute: (BuildContext context) => TypographyDemo(),
buildRoute: (BuildContext context) => const TypographyDemo(),
),
// Material Components
@ -164,7 +164,7 @@ List<GalleryDemo> _buildGalleryDemos() {
icon: GalleryIcons.backdrop,
category: _kMaterialComponents,
routeName: BackdropDemo.routeName,
buildRoute: (BuildContext context) => BackdropDemo(),
buildRoute: (BuildContext context) => const BackdropDemo(),
),
GalleryDemo(
title: 'Banner',
@ -182,7 +182,7 @@ List<GalleryDemo> _buildGalleryDemos() {
category: _kMaterialComponents,
routeName: BottomAppBarDemo.routeName,
documentationUrl: 'https://api.flutter.dev/flutter/material/BottomAppBar-class.html',
buildRoute: (BuildContext context) => BottomAppBarDemo(),
buildRoute: (BuildContext context) => const BottomAppBarDemo(),
),
GalleryDemo(
title: 'Bottom navigation',
@ -191,7 +191,7 @@ List<GalleryDemo> _buildGalleryDemos() {
category: _kMaterialComponents,
routeName: BottomNavigationDemo.routeName,
documentationUrl: 'https://api.flutter.dev/flutter/material/BottomNavigationBar-class.html',
buildRoute: (BuildContext context) => BottomNavigationDemo(),
buildRoute: (BuildContext context) => const BottomNavigationDemo(),
),
GalleryDemo(
title: 'Bottom sheet: Modal',
@ -200,7 +200,7 @@ List<GalleryDemo> _buildGalleryDemos() {
category: _kMaterialComponents,
routeName: ModalBottomSheetDemo.routeName,
documentationUrl: 'https://api.flutter.dev/flutter/material/showModalBottomSheet.html',
buildRoute: (BuildContext context) => ModalBottomSheetDemo(),
buildRoute: (BuildContext context) => const ModalBottomSheetDemo(),
),
GalleryDemo(
title: 'Bottom sheet: Persistent',
@ -209,7 +209,7 @@ List<GalleryDemo> _buildGalleryDemos() {
category: _kMaterialComponents,
routeName: PersistentBottomSheetDemo.routeName,
documentationUrl: 'https://api.flutter.dev/flutter/material/ScaffoldState/showBottomSheet.html',
buildRoute: (BuildContext context) => PersistentBottomSheetDemo(),
buildRoute: (BuildContext context) => const PersistentBottomSheetDemo(),
),
GalleryDemo(
title: 'Buttons',
@ -217,7 +217,7 @@ List<GalleryDemo> _buildGalleryDemos() {
icon: GalleryIcons.generic_buttons,
category: _kMaterialComponents,
routeName: ButtonsDemo.routeName,
buildRoute: (BuildContext context) => ButtonsDemo(),
buildRoute: (BuildContext context) => const ButtonsDemo(),
),
GalleryDemo(
title: 'Buttons: Floating Action Button',
@ -226,7 +226,7 @@ List<GalleryDemo> _buildGalleryDemos() {
category: _kMaterialComponents,
routeName: TabsFabDemo.routeName,
documentationUrl: 'https://api.flutter.dev/flutter/material/FloatingActionButton-class.html',
buildRoute: (BuildContext context) => TabsFabDemo(),
buildRoute: (BuildContext context) => const TabsFabDemo(),
),
GalleryDemo(
title: 'Cards',
@ -235,7 +235,7 @@ List<GalleryDemo> _buildGalleryDemos() {
category: _kMaterialComponents,
routeName: CardsDemo.routeName,
documentationUrl: 'https://api.flutter.dev/flutter/material/Card-class.html',
buildRoute: (BuildContext context) => CardsDemo(),
buildRoute: (BuildContext context) => const CardsDemo(),
),
GalleryDemo(
title: 'Chips',
@ -244,7 +244,7 @@ List<GalleryDemo> _buildGalleryDemos() {
category: _kMaterialComponents,
routeName: ChipDemo.routeName,
documentationUrl: 'https://api.flutter.dev/flutter/material/Chip-class.html',
buildRoute: (BuildContext context) => ChipDemo(),
buildRoute: (BuildContext context) => const ChipDemo(),
),
GalleryDemo(
title: 'Data tables',
@ -253,7 +253,7 @@ List<GalleryDemo> _buildGalleryDemos() {
category: _kMaterialComponents,
routeName: DataTableDemo.routeName,
documentationUrl: 'https://api.flutter.dev/flutter/material/PaginatedDataTable-class.html',
buildRoute: (BuildContext context) => DataTableDemo(),
buildRoute: (BuildContext context) => const DataTableDemo(),
),
GalleryDemo(
title: 'Dialogs',
@ -262,7 +262,7 @@ List<GalleryDemo> _buildGalleryDemos() {
category: _kMaterialComponents,
routeName: DialogDemo.routeName,
documentationUrl: 'https://api.flutter.dev/flutter/material/showDialog.html',
buildRoute: (BuildContext context) => DialogDemo(),
buildRoute: (BuildContext context) => const DialogDemo(),
),
GalleryDemo(
title: 'Elevations',
@ -272,7 +272,7 @@ List<GalleryDemo> _buildGalleryDemos() {
category: _kMaterialComponents,
routeName: ElevationDemo.routeName,
documentationUrl: 'https://api.flutter.dev/flutter/material/Material/elevation.html',
buildRoute: (BuildContext context) => ElevationDemo(),
buildRoute: (BuildContext context) => const ElevationDemo(),
),
GalleryDemo(
title: 'Expand/collapse list control',
@ -281,7 +281,7 @@ List<GalleryDemo> _buildGalleryDemos() {
category: _kMaterialComponents,
routeName: ExpansionTileListDemo.routeName,
documentationUrl: 'https://api.flutter.dev/flutter/material/ExpansionTile-class.html',
buildRoute: (BuildContext context) => ExpansionTileListDemo(),
buildRoute: (BuildContext context) => const ExpansionTileListDemo(),
),
GalleryDemo(
title: 'Expansion panels',
@ -290,7 +290,7 @@ List<GalleryDemo> _buildGalleryDemos() {
category: _kMaterialComponents,
routeName: ExpansionPanelsDemo.routeName,
documentationUrl: 'https://api.flutter.dev/flutter/material/ExpansionPanel-class.html',
buildRoute: (BuildContext context) => ExpansionPanelsDemo(),
buildRoute: (BuildContext context) => const ExpansionPanelsDemo(),
),
GalleryDemo(
title: 'Grid',
@ -308,7 +308,7 @@ List<GalleryDemo> _buildGalleryDemos() {
category: _kMaterialComponents,
routeName: IconsDemo.routeName,
documentationUrl: 'https://api.flutter.dev/flutter/material/IconButton-class.html',
buildRoute: (BuildContext context) => IconsDemo(),
buildRoute: (BuildContext context) => const IconsDemo(),
),
GalleryDemo(
title: 'Lists',
@ -353,7 +353,7 @@ List<GalleryDemo> _buildGalleryDemos() {
category: _kMaterialComponents,
routeName: DrawerDemo.routeName,
documentationUrl: 'https://api.flutter.dev/flutter/material/Drawer-class.html',
buildRoute: (BuildContext context) => DrawerDemo(),
buildRoute: (BuildContext context) => const DrawerDemo(),
),
GalleryDemo(
title: 'Pagination',
@ -362,7 +362,7 @@ List<GalleryDemo> _buildGalleryDemos() {
category: _kMaterialComponents,
routeName: PageSelectorDemo.routeName,
documentationUrl: 'https://api.flutter.dev/flutter/material/TabBarView-class.html',
buildRoute: (BuildContext context) => PageSelectorDemo(),
buildRoute: (BuildContext context) => const PageSelectorDemo(),
),
GalleryDemo(
title: 'Pickers',
@ -371,7 +371,7 @@ List<GalleryDemo> _buildGalleryDemos() {
category: _kMaterialComponents,
routeName: DateAndTimePickerDemo.routeName,
documentationUrl: 'https://api.flutter.dev/flutter/material/showDatePicker.html',
buildRoute: (BuildContext context) => DateAndTimePickerDemo(),
buildRoute: (BuildContext context) => const DateAndTimePickerDemo(),
),
GalleryDemo(
title: 'Progress indicators',
@ -380,7 +380,7 @@ List<GalleryDemo> _buildGalleryDemos() {
category: _kMaterialComponents,
routeName: ProgressIndicatorDemo.routeName,
documentationUrl: 'https://api.flutter.dev/flutter/material/LinearProgressIndicator-class.html',
buildRoute: (BuildContext context) => ProgressIndicatorDemo(),
buildRoute: (BuildContext context) => const ProgressIndicatorDemo(),
),
GalleryDemo(
title: 'Pull to refresh',
@ -398,7 +398,7 @@ List<GalleryDemo> _buildGalleryDemos() {
category: _kMaterialComponents,
routeName: SearchDemo.routeName,
documentationUrl: 'https://api.flutter.dev/flutter/material/showSearch.html',
buildRoute: (BuildContext context) => SearchDemo(),
buildRoute: (BuildContext context) => const SearchDemo(),
),
GalleryDemo(
title: 'Selection controls',
@ -406,7 +406,7 @@ List<GalleryDemo> _buildGalleryDemos() {
icon: GalleryIcons.check_box,
category: _kMaterialComponents,
routeName: SelectionControlsDemo.routeName,
buildRoute: (BuildContext context) => SelectionControlsDemo(),
buildRoute: (BuildContext context) => const SelectionControlsDemo(),
),
GalleryDemo(
title: 'Sliders',
@ -415,7 +415,7 @@ List<GalleryDemo> _buildGalleryDemos() {
category: _kMaterialComponents,
routeName: SliderDemo.routeName,
documentationUrl: 'https://api.flutter.dev/flutter/material/Slider-class.html',
buildRoute: (BuildContext context) => SliderDemo(),
buildRoute: (BuildContext context) => const SliderDemo(),
),
GalleryDemo(
title: 'Snackbar',
@ -433,7 +433,7 @@ List<GalleryDemo> _buildGalleryDemos() {
category: _kMaterialComponents,
routeName: TabsDemo.routeName,
documentationUrl: 'https://api.flutter.dev/flutter/material/TabBarView-class.html',
buildRoute: (BuildContext context) => TabsDemo(),
buildRoute: (BuildContext context) => const TabsDemo(),
),
GalleryDemo(
title: 'Tabs: Scrolling',
@ -442,7 +442,7 @@ List<GalleryDemo> _buildGalleryDemos() {
icon: GalleryIcons.tabs,
routeName: ScrollableTabsDemo.routeName,
documentationUrl: 'https://api.flutter.dev/flutter/material/TabBar-class.html',
buildRoute: (BuildContext context) => ScrollableTabsDemo(),
buildRoute: (BuildContext context) => const ScrollableTabsDemo(),
),
GalleryDemo(
title: 'Text fields',
@ -460,7 +460,7 @@ List<GalleryDemo> _buildGalleryDemos() {
category: _kMaterialComponents,
routeName: TooltipDemo.routeName,
documentationUrl: 'https://api.flutter.dev/flutter/material/Tooltip-class.html',
buildRoute: (BuildContext context) => TooltipDemo(),
buildRoute: (BuildContext context) => const TooltipDemo(),
),
// Cupertino Components
@ -470,7 +470,7 @@ List<GalleryDemo> _buildGalleryDemos() {
category: _kCupertinoComponents,
routeName: CupertinoProgressIndicatorDemo.routeName,
documentationUrl: 'https://api.flutter.dev/flutter/cupertino/CupertinoActivityIndicator-class.html',
buildRoute: (BuildContext context) => CupertinoProgressIndicatorDemo(),
buildRoute: (BuildContext context) => const CupertinoProgressIndicatorDemo(),
),
GalleryDemo(
title: 'Alerts',
@ -478,7 +478,7 @@ List<GalleryDemo> _buildGalleryDemos() {
category: _kCupertinoComponents,
routeName: CupertinoAlertDemo.routeName,
documentationUrl: 'https://api.flutter.dev/flutter/cupertino/showCupertinoDialog.html',
buildRoute: (BuildContext context) => CupertinoAlertDemo(),
buildRoute: (BuildContext context) => const CupertinoAlertDemo(),
),
GalleryDemo(
title: 'Buttons',
@ -486,7 +486,7 @@ List<GalleryDemo> _buildGalleryDemos() {
category: _kCupertinoComponents,
routeName: CupertinoButtonsDemo.routeName,
documentationUrl: 'https://api.flutter.dev/flutter/cupertino/CupertinoButton-class.html',
buildRoute: (BuildContext context) => CupertinoButtonsDemo(),
buildRoute: (BuildContext context) => const CupertinoButtonsDemo(),
),
GalleryDemo(
title: 'Navigation',
@ -502,7 +502,7 @@ List<GalleryDemo> _buildGalleryDemos() {
category: _kCupertinoComponents,
routeName: CupertinoPickerDemo.routeName,
documentationUrl: 'https://api.flutter.dev/flutter/cupertino/CupertinoPicker-class.html',
buildRoute: (BuildContext context) => CupertinoPickerDemo(),
buildRoute: (BuildContext context) => const CupertinoPickerDemo(),
),
GalleryDemo(
title: 'Pull to refresh',
@ -510,7 +510,7 @@ List<GalleryDemo> _buildGalleryDemos() {
category: _kCupertinoComponents,
routeName: CupertinoRefreshControlDemo.routeName,
documentationUrl: 'https://api.flutter.dev/flutter/cupertino/CupertinoSliverRefreshControl-class.html',
buildRoute: (BuildContext context) => CupertinoRefreshControlDemo(),
buildRoute: (BuildContext context) => const CupertinoRefreshControlDemo(),
),
GalleryDemo(
title: 'Segmented Control',
@ -518,7 +518,7 @@ List<GalleryDemo> _buildGalleryDemos() {
category: _kCupertinoComponents,
routeName: CupertinoSegmentedControlDemo.routeName,
documentationUrl: 'https://api.flutter.dev/flutter/cupertino/CupertinoSegmentedControl-class.html',
buildRoute: (BuildContext context) => CupertinoSegmentedControlDemo(),
buildRoute: (BuildContext context) => const CupertinoSegmentedControlDemo(),
),
GalleryDemo(
title: 'Sliders',
@ -526,7 +526,7 @@ List<GalleryDemo> _buildGalleryDemos() {
category: _kCupertinoComponents,
routeName: CupertinoSliderDemo.routeName,
documentationUrl: 'https://api.flutter.dev/flutter/cupertino/CupertinoSlider-class.html',
buildRoute: (BuildContext context) => CupertinoSliderDemo(),
buildRoute: (BuildContext context) => const CupertinoSliderDemo(),
),
GalleryDemo(
title: 'Switches',
@ -534,14 +534,14 @@ List<GalleryDemo> _buildGalleryDemos() {
category: _kCupertinoComponents,
routeName: CupertinoSwitchDemo.routeName,
documentationUrl: 'https://api.flutter.dev/flutter/cupertino/CupertinoSwitch-class.html',
buildRoute: (BuildContext context) => CupertinoSwitchDemo(),
buildRoute: (BuildContext context) => const CupertinoSwitchDemo(),
),
GalleryDemo(
title: 'Text Fields',
icon: GalleryIcons.text_fields_alt,
category: _kCupertinoComponents,
routeName: CupertinoTextFieldDemo.routeName,
buildRoute: (BuildContext context) => CupertinoTextFieldDemo(),
buildRoute: (BuildContext context) => const CupertinoTextFieldDemo(),
),
// Media
@ -551,7 +551,7 @@ List<GalleryDemo> _buildGalleryDemos() {
icon: GalleryIcons.animation,
category: _kMedia,
routeName: ImagesDemo.routeName,
buildRoute: (BuildContext context) => ImagesDemo(),
buildRoute: (BuildContext context) => const ImagesDemo(),
),
GalleryDemo(
title: 'Video',

Some files were not shown because too many files have changed in this diff Show more