Commit 95418482 authored by Alexandre Ardhuin's avatar Alexandre Ardhuin Committed by GitHub

make @immutable const classes (#9532)

* make @immutable const

* fix build
parent 1abb6f5d
......@@ -24,7 +24,7 @@ class ComplexLayoutAppState extends State<ComplexLayoutApp> {
return new MaterialApp(
theme: lightTheme ? new ThemeData.light() : new ThemeData.dark(),
title: 'Advanced Layout',
home: new ComplexLayout()
home: const ComplexLayout()
);
}
......@@ -44,7 +44,7 @@ class ComplexLayoutAppState extends State<ComplexLayoutApp> {
}
class ComplexLayout extends StatefulWidget {
ComplexLayout({ Key key }) : super(key: key);
const ComplexLayout({ Key key }) : super(key: key);
@override
ComplexLayoutState createState() => new ComplexLayoutState();
......@@ -85,7 +85,7 @@ class ComplexLayoutState extends State<ComplexLayout> {
new BottomBar(),
],
),
drawer: new GalleryDrawer(),
drawer: const GalleryDrawer(),
);
}
}
......@@ -100,9 +100,9 @@ class TopBarMenu extends StatelessWidget {
value: 'Friends',
child: new MenuItemWithIcon(Icons.people, 'Friends', '5 new')
),
new PopupMenuItem<String>(
const PopupMenuItem<String>(
value: 'Events',
child: new MenuItemWithIcon(Icons.event, 'Events', '12 upcoming')
child: const MenuItemWithIcon(Icons.event, 'Events', '12 upcoming')
),
new PopupMenuItem<String>(
value: 'Events',
......@@ -120,9 +120,9 @@ class TopBarMenu extends StatelessWidget {
value: 'Friends',
child: new MenuItemWithIcon(Icons.people, 'Friends', '5')
),
new PopupMenuItem<String>(
const PopupMenuItem<String>(
value: 'Events',
child: new MenuItemWithIcon(Icons.event, 'Events', '12')
child: const MenuItemWithIcon(Icons.event, 'Events', '12')
),
new PopupMenuItem<String>(
value: 'Events',
......@@ -142,7 +142,7 @@ class TopBarMenu extends StatelessWidget {
}
class MenuItemWithIcon extends StatelessWidget {
MenuItemWithIcon(this.icon, this.title, this.subtitle);
const MenuItemWithIcon(this.icon, this.title, this.subtitle);
final IconData icon;
final String title;
......@@ -164,7 +164,7 @@ class MenuItemWithIcon extends StatelessWidget {
}
class FancyImageItem extends StatelessWidget {
FancyImageItem(this.index, {Key key}) : super(key: key);
const FancyImageItem(this.index, {Key key}) : super(key: key);
final int index;
......@@ -188,14 +188,14 @@ class FancyImageItem extends StatelessWidget {
}
class FancyGalleryItem extends StatelessWidget {
FancyGalleryItem(this.index, {Key key}) : super(key: key);
const FancyGalleryItem(this.index, {Key key}) : super(key: key);
final int index;
@override
Widget build(BuildContext context) {
return new ListBody(
children: <Widget>[
new UserHeader('Ali Connors'),
const UserHeader('Ali Connors'),
new ItemGalleryBox(index),
new InfoBar(),
new Padding(
......@@ -217,7 +217,7 @@ class InfoBar extends StatelessWidget {
child: new Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
new MiniIconWithText(Icons.thumb_up, '42'),
const MiniIconWithText(Icons.thumb_up, '42'),
new Text('3 Comments', style: Theme.of(context).textTheme.caption)
]
)
......@@ -233,9 +233,9 @@ class IconBar extends StatelessWidget {
child: new Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
new IconWithText(Icons.thumb_up, 'Like'),
const IconWithText(Icons.thumb_up, 'Like'),
new IconWithText(Icons.comment, 'Comment'),
new IconWithText(Icons.share, 'Share'),
const IconWithText(Icons.share, 'Share'),
]
)
);
......@@ -243,7 +243,7 @@ class IconBar extends StatelessWidget {
}
class IconWithText extends StatelessWidget {
IconWithText(this.icon, this.title);
const IconWithText(this.icon, this.title);
final IconData icon;
final String title;
......@@ -264,7 +264,7 @@ class IconWithText extends StatelessWidget {
}
class MiniIconWithText extends StatelessWidget {
MiniIconWithText(this.icon, this.title);
const MiniIconWithText(this.icon, this.title);
final IconData icon;
final String title;
......@@ -305,7 +305,7 @@ class FatDivider extends StatelessWidget {
}
class UserHeader extends StatelessWidget {
UserHeader(this.userName);
const UserHeader(this.userName);
final String userName;
......@@ -443,7 +443,7 @@ class ItemImageBox extends StatelessWidget {
}
class ItemGalleryBox extends StatelessWidget {
ItemGalleryBox(this.index);
const ItemGalleryBox(this.index);
final int index;
......@@ -506,7 +506,7 @@ class ItemGalleryBox extends StatelessWidget {
)
),
new Container(
child: new TabPageSelector()
child: const TabPageSelector()
)
]
)
......@@ -542,7 +542,7 @@ class BottomBar extends StatelessWidget {
}
class BottomBarButton extends StatelessWidget {
BottomBarButton(this.icon, this.title);
const BottomBarButton(this.icon, this.title);
final IconData icon;
final String title;
......@@ -565,7 +565,7 @@ class BottomBarButton extends StatelessWidget {
}
class GalleryDrawer extends StatelessWidget {
GalleryDrawer({ Key key }) : super(key: key);
const GalleryDrawer({ Key key }) : super(key: key);
void _changeTheme(BuildContext context, bool value) {
ComplexLayoutApp.of(context).lightTheme = value;
......
......@@ -74,7 +74,7 @@ class DotState extends State<Dot> {
}
class ExampleDragSource extends StatelessWidget {
ExampleDragSource({
const ExampleDragSource({
Key key,
this.color,
this.heavy: false,
......@@ -174,7 +174,7 @@ class DashOutlineCirclePainter extends CustomPainter {
}
class MovableBall extends StatelessWidget {
MovableBall(this.position, this.ballPosition, this.callback);
const MovableBall(this.position, this.ballPosition, this.callback);
final int position;
final int ballPosition;
......
......@@ -103,7 +103,7 @@ class _PointDemoPainter extends CustomPainter {
}
class _PointDemo extends StatefulWidget {
_PointDemo({ Key key, this.controller }) : super(key: key);
const _PointDemo({ Key key, this.controller }) : super(key: key);
final AnimationController controller;
......@@ -268,7 +268,7 @@ class _RectangleDemoPainter extends CustomPainter {
}
class _RectangleDemo extends StatefulWidget {
_RectangleDemo({ Key key, this.controller }) : super(key: key);
const _RectangleDemo({ Key key, this.controller }) : super(key: key);
final AnimationController controller;
......@@ -404,7 +404,7 @@ class _ArcDemo {
}
class AnimationDemo extends StatefulWidget {
AnimationDemo({ Key key }) : super(key: key);
const AnimationDemo({ Key key }) : super(key: key);
@override
_AnimationDemoState createState() => new _AnimationDemoState();
......@@ -469,6 +469,6 @@ class _AnimationDemoState extends State<AnimationDemo> with TickerProviderStateM
void main() {
runApp(new MaterialApp(
home: new AnimationDemo()
home: const AnimationDemo()
));
}
......@@ -57,7 +57,7 @@ class _MarkerPainter extends CustomPainter {
}
class Marker extends StatelessWidget {
Marker({
const Marker({
Key key,
this.type: MarkerType.touch,
this.position,
......
......@@ -12,15 +12,15 @@ void main() {
appBar: new AppBar(
title: const Text('Hardware Key Demo'),
),
body: new Center(
child: new RawKeyboardDemo(),
body: const Center(
child: const RawKeyboardDemo(),
),
),
));
}
class RawKeyboardDemo extends StatefulWidget {
RawKeyboardDemo({ Key key }) : super(key: key);
const RawKeyboardDemo({ Key key }) : super(key: key);
@override
_HardwareKeyDemoState createState() => new _HardwareKeyDemoState();
......
......@@ -366,7 +366,7 @@ class _AllSectionsView extends AnimatedWidget {
}
class AnimationDemoHome extends StatefulWidget {
AnimationDemoHome({ Key key }) : super(key: key);
const AnimationDemoHome({ Key key }) : super(key: key);
static const String routeName = '/animation';
......
......@@ -100,7 +100,7 @@ class SectionTitle extends StatelessWidget {
// Small horizontal bar that indicates the selected section.
class SectionIndicator extends StatelessWidget {
SectionIndicator({ Key key, this.opacity: 1.0 }) : super(key: key);
const SectionIndicator({ Key key, this.opacity: 1.0 }) : super(key: key);
final double opacity;
......
......@@ -7,10 +7,10 @@ import 'package:flutter/material.dart';
import 'animation/home.dart';
class AnimationDemo extends StatelessWidget {
AnimationDemo({Key key}) : super(key: key);
const AnimationDemo({Key key}) : super(key: key);
static const String routeName = '/animation';
@override
Widget build(BuildContext context) => new AnimationDemoHome();
Widget build(BuildContext context) => const AnimationDemoHome();
}
......@@ -7,7 +7,7 @@ import 'package:flutter/material.dart';
import 'logic.dart';
class Calculator extends StatefulWidget {
Calculator({Key key}) : super(key: key);
const Calculator({Key key}) : super(key: key);
@override
_CalculatorState createState() => new _CalculatorState();
......@@ -138,7 +138,7 @@ class _CalculatorState extends State<Calculator> {
}
class CalcDisplay extends StatelessWidget {
CalcDisplay({ this.content });
const CalcDisplay({ this.content });
final String content;
......@@ -154,7 +154,7 @@ class CalcDisplay extends StatelessWidget {
}
class KeyPad extends StatelessWidget {
KeyPad({ this.calcState });
const KeyPad({ this.calcState });
final _CalculatorState calcState;
......@@ -222,7 +222,7 @@ class KeyPad extends StatelessWidget {
}
class KeyRow extends StatelessWidget {
KeyRow(this.keys);
const KeyRow(this.keys);
final List<Widget> keys;
......@@ -238,7 +238,7 @@ class KeyRow extends StatelessWidget {
}
class CalcKey extends StatelessWidget {
CalcKey(this.text, this.onTap);
const CalcKey(this.text, this.onTap);
final String text;
final GestureTapCallback onTap;
......
......@@ -7,10 +7,10 @@ import 'package:flutter/material.dart';
import 'calculator/home.dart';
class CalculatorDemo extends StatelessWidget {
CalculatorDemo({Key key}) : super(key: key);
const CalculatorDemo({Key key}) : super(key: key);
static const String routeName = '/calculator';
@override
Widget build(BuildContext context) => new Calculator();
Widget build(BuildContext context) => const Calculator();
}
......@@ -5,7 +5,7 @@
import 'package:flutter/material.dart';
class _ContactCategory extends StatelessWidget {
_ContactCategory({ Key key, this.icon, this.children }) : super(key: key);
const _ContactCategory({ Key key, this.icon, this.children }) : super(key: key);
final IconData icon;
final List<Widget> children;
......
......@@ -100,7 +100,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
// Perform some action
},
),
new RaisedButton(
const RaisedButton(
child: const Text('DISABLED'),
onPressed: null,
)
......
......@@ -26,8 +26,8 @@ class _ChipDemoState extends State<ChipDemo> {
const Chip(
label: const Text('Apple')
),
new Chip(
avatar: new CircleAvatar(child: const Text('B')),
const Chip(
avatar: const CircleAvatar(child: const Text('B')),
label: const Text('Blueberry')
),
];
......
......@@ -8,7 +8,7 @@ import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
class _InputDropdown extends StatelessWidget {
_InputDropdown({
const _InputDropdown({
Key key,
this.child,
this.labelText,
......@@ -47,7 +47,7 @@ class _InputDropdown extends StatelessWidget {
}
class _DateTimePicker extends StatelessWidget {
_DateTimePicker({
const _DateTimePicker({
Key key,
this.labelText,
this.selectedDate,
......
......@@ -20,7 +20,7 @@ const String _alertWithTitleText =
"data to Google, even when no apps are running.";
class DialogDemoItem extends StatelessWidget {
DialogDemoItem({ Key key, this.icon, this.color, this.text, this.onPressed }) : super(key: key);
const DialogDemoItem({ Key key, this.icon, this.color, this.text, this.onPressed }) : super(key: key);
final IconData icon;
final Color color;
......
......@@ -14,7 +14,7 @@ typedef Widget DemoItemBodyBuilder<T>(DemoItem<T> item);
typedef String ValueToString<T>(T value);
class DualHeaderWithHint extends StatelessWidget {
DualHeaderWithHint({
const DualHeaderWithHint({
this.name,
this.value,
this.hint,
......@@ -76,7 +76,7 @@ class DualHeaderWithHint extends StatelessWidget {
}
class CollapsibleBody extends StatelessWidget {
CollapsibleBody({
const CollapsibleBody({
this.margin: EdgeInsets.zero,
this.child,
this.onSave,
......
......@@ -29,7 +29,7 @@ class Photo {
}
class GridPhotoViewer extends StatefulWidget {
GridPhotoViewer({ Key key, this.photo }) : super(key: key);
const GridPhotoViewer({ Key key, this.photo }) : super(key: key);
final Photo photo;
......@@ -38,7 +38,7 @@ class GridPhotoViewer extends StatefulWidget {
}
class _GridTitleText extends StatelessWidget {
_GridTitleText(this.text);
const _GridTitleText(this.text);
final String text;
......@@ -227,7 +227,7 @@ class GridDemoPhotoItem extends StatelessWidget {
}
class GridListDemo extends StatefulWidget {
GridListDemo({ Key key }) : super(key: key);
const GridListDemo({ Key key }) : super(key: key);
static const String routeName = '/material/grid-list';
......
......@@ -29,7 +29,7 @@ class LeaveBehindItem implements Comparable<LeaveBehindItem> {
}
class LeaveBehindDemo extends StatefulWidget {
LeaveBehindDemo({ Key key }) : super(key: key);
const LeaveBehindDemo({ Key key }) : super(key: key);
static const String routeName = '/material/leave-behind';
......
......@@ -5,7 +5,7 @@
import 'package:flutter/material.dart';
class ListDemo extends StatefulWidget {
ListDemo({ Key key }) : super(key: key);
const ListDemo({ Key key }) : super(key: key);
static const String routeName = '/material/list';
......
......@@ -5,7 +5,7 @@
import 'package:flutter/material.dart';
class MenuDemo extends StatefulWidget {
MenuDemo({ Key key }) : super(key: key);
const MenuDemo({ Key key }) : super(key: key);
static const String routeName = '/material/menu';
......
......@@ -9,7 +9,7 @@ import 'package:flutter/material.dart';
enum IndicatorType { overscroll, refresh }
class OverscrollDemo extends StatefulWidget {
OverscrollDemo({ Key key }) : super(key: key);
const OverscrollDemo({ Key key }) : super(key: key);
static const String routeName = '/material/overscroll';
......
......@@ -5,7 +5,7 @@
import 'package:flutter/material.dart';
class _PageSelector extends StatelessWidget {
_PageSelector({ this.icons });
const _PageSelector({ this.icons });
final List<IconData> icons;
......
......@@ -98,8 +98,8 @@ class _SelectionControlsDemoState extends State<SelectionControlsDemo> {
mainAxisSize: MainAxisSize.min,
children: <Widget>[
// Disabled checkboxes
new Checkbox(value: true, onChanged: null),
new Checkbox(value: false, onChanged: null)
const Checkbox(value: true, onChanged: null),
const Checkbox(value: false, onChanged: null)
]
)
]
......@@ -137,17 +137,17 @@ class _SelectionControlsDemoState extends State<SelectionControlsDemo> {
new Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
new Radio<int>(
const Radio<int>(
value: 0,
groupValue: 0,
onChanged: null
),
new Radio<int>(
const Radio<int>(
value: 1,
groupValue: 0,
onChanged: null
),
new Radio<int>(
const Radio<int>(
value: 2,
groupValue: 0,
onChanged: null
......
......@@ -17,7 +17,7 @@ const String _text3 =
"By default snackbars automatically disappear after a few seconds ";
class SnackBarDemo extends StatefulWidget {
SnackBarDemo({ Key key }) : super(key: key);
const SnackBarDemo({ Key key }) : super(key: key);
static const String routeName = '/material/snack-bar';
......
......@@ -75,7 +75,7 @@ final Map<_Page, List<_CardData>> _allPages = <_Page, List<_CardData>>{
};
class _CardDataItem extends StatelessWidget {
_CardDataItem({ this.page, this.data });
const _CardDataItem({ this.page, this.data });
static final double height = 272.0;
final _Page page;
......
......@@ -7,7 +7,7 @@ import 'dart:async';
import 'package:flutter/material.dart';
class TextFormFieldDemo extends StatefulWidget {
TextFormFieldDemo({ Key key }) : super(key: key);
const TextFormFieldDemo({ Key key }) : super(key: key);
static const String routeName = '/material/text-form-field';
......
......@@ -6,7 +6,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
class PestoDemo extends StatelessWidget {
PestoDemo({ Key key }) : super(key: key);
const PestoDemo({ Key key }) : super(key: key);
static const String routeName = '/pesto';
......@@ -31,7 +31,7 @@ final ThemeData _kTheme = new ThemeData(
class PestoHome extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new RecipeGridPage(recipes: kPestoRecipes);
return const RecipeGridPage(recipes: kPestoRecipes);
}
}
......@@ -63,7 +63,7 @@ class PestoStyle extends TextStyle {
// Displays a grid of recipe cards.
class RecipeGridPage extends StatefulWidget {
RecipeGridPage({ Key key, this.recipes }) : super(key: key);
const RecipeGridPage({ Key key, this.recipes }) : super(key: key);
final List<Recipe> recipes;
......@@ -180,7 +180,7 @@ class _RecipeGridPageState extends State<RecipeGridPage> {
}
class PestoLogo extends StatefulWidget {
PestoLogo({this.height, this.t});
const PestoLogo({this.height, this.t});
final double height;
final double t;
......@@ -239,7 +239,7 @@ class RecipeCard extends StatelessWidget {
final TextStyle titleStyle = const PestoStyle(fontSize: 24.0, fontWeight: FontWeight.w600);
final TextStyle authorStyle = const PestoStyle(fontWeight: FontWeight.w500, color: Colors.black54);
RecipeCard({ Key key, this.recipe, this.onTap }) : super(key: key);
const RecipeCard({ Key key, this.recipe, this.onTap }) : super(key: key);
final Recipe recipe;
final VoidCallback onTap;
......@@ -289,7 +289,7 @@ class RecipeCard extends StatelessWidget {
// Displays one recipe. Includes the recipe sheet with a background image.
class RecipePage extends StatefulWidget {
RecipePage({ Key key, this.recipe }) : super(key: key);
const RecipePage({ Key key, this.recipe }) : super(key: key);
final Recipe recipe;
......
......@@ -148,9 +148,9 @@ class _VendorItem extends StatelessWidget {
// Displays the product's price. If the product is in the shopping cart then the
// background is highlighted.
abstract class _PriceItem extends StatelessWidget {
_PriceItem({ Key key, @required this.product }) : super(key: key) {
assert(product != null);
}
const _PriceItem({ Key key, @required this.product })
: assert(product != null),
super(key: key);
final Product product;
......@@ -168,7 +168,7 @@ abstract class _PriceItem extends StatelessWidget {
}
class _ProductPriceItem extends _PriceItem {
_ProductPriceItem({ Key key, Product product }) : super(key: key, product: product);
const _ProductPriceItem({ Key key, Product product }) : super(key: key, product: product);
@override
Widget build(BuildContext context) {
......@@ -181,7 +181,7 @@ class _ProductPriceItem extends _PriceItem {
}
class _FeaturePriceItem extends _PriceItem {
_FeaturePriceItem({ Key key, Product product }) : super(key: key, product: product);
const _FeaturePriceItem({ Key key, Product product }) : super(key: key, product: product);
@override
Widget build(BuildContext context) {
......
......@@ -32,7 +32,7 @@ final ThemeData _kGalleryDarkTheme = new ThemeData(
);
class GalleryApp extends StatefulWidget {
GalleryApp({
const GalleryApp({
this.updateUrlFetcher,
this.enablePerformanceOverlay: true,
this.checkerboardRasterCacheImages: true,
......
......@@ -33,7 +33,7 @@ class ComponentDemoTabData {
}
class TabbedComponentDemoScaffold extends StatelessWidget {
TabbedComponentDemoScaffold({
const TabbedComponentDemoScaffold({
this.title,
this.demos
});
......@@ -96,7 +96,7 @@ class TabbedComponentDemoScaffold extends StatelessWidget {
}
class FullScreenCodeDialog extends StatefulWidget {
FullScreenCodeDialog({ this.exampleCodeTag });
const FullScreenCodeDialog({ this.exampleCodeTag });
final String exampleCodeTag;
......
......@@ -25,7 +25,7 @@ new RaisedButton(
// Create a disabled button.
// Buttons are disabled when onPressed isn't
// specified or is null.
new RaisedButton(
const RaisedButton(
child: const Text('BUTTON TITLE'),
onPressed: null
);
......@@ -130,7 +130,7 @@ new Checkbox(
// Create a disabled checkbox.
// Checkboxes are disabled when onChanged isn't
// specified or null.
new Checkbox(value: false, onChanged: null);
const Checkbox(value: false, onChanged: null);
// END
......@@ -167,7 +167,7 @@ new Row(
);
// Creates a disabled radio button.
new Radio<int>(
const Radio<int>(
value: 0,
groupValue: 0,
onChanged: null
......
......@@ -36,7 +36,7 @@ final List<_BackgroundLayer> _kBackgroundLayers = <_BackgroundLayer>[
];
class _AppBarBackground extends StatelessWidget {
_AppBarBackground({ Key key, this.animation }) : super(key: key);
const _AppBarBackground({ Key key, this.animation }) : super(key: key);
final Animation<double> animation;
......
......@@ -73,7 +73,7 @@ List<GalleryItem> _buildGalleryItems() {
subtitle: 'Section organizer',
category: 'Demos',
routeName: AnimationDemo.routeName,
buildRoute: (BuildContext context) => new AnimationDemo(),
buildRoute: (BuildContext context) => const AnimationDemo(),
),
// Material Components
new GalleryItem(
......@@ -151,7 +151,7 @@ List<GalleryItem> _buildGalleryItems() {
subtitle: 'Row and column layout',
category: 'Material Components',
routeName: GridListDemo.routeName,
buildRoute: (BuildContext context) => new GridListDemo(),
buildRoute: (BuildContext context) => const GridListDemo(),
),
new GalleryItem(
title: 'Icons',
......@@ -165,21 +165,21 @@ List<GalleryItem> _buildGalleryItems() {
subtitle: 'List items with hidden actions',
category: 'Material Components',
routeName: LeaveBehindDemo.routeName,
buildRoute: (BuildContext context) => new LeaveBehindDemo(),
buildRoute: (BuildContext context) => const LeaveBehindDemo(),
),
new GalleryItem(
title: 'List',
subtitle: 'Layout variations for scrollable lists',
category: 'Material Components',
routeName: ListDemo.routeName,
buildRoute: (BuildContext context) => new ListDemo(),
buildRoute: (BuildContext context) => const ListDemo(),
),
new GalleryItem(
title: 'Menus',
subtitle: 'Menu buttons and simple menus',
category: 'Material Components',
routeName: MenuDemo.routeName,
buildRoute: (BuildContext context) => new MenuDemo(),
buildRoute: (BuildContext context) => const MenuDemo(),
),
new GalleryItem(
title: 'Modal bottom sheet',
......@@ -214,7 +214,7 @@ List<GalleryItem> _buildGalleryItems() {
subtitle: 'Refresh indicators',
category: 'Material Components',
routeName: OverscrollDemo.routeName,
buildRoute: (BuildContext context) => new OverscrollDemo(),
buildRoute: (BuildContext context) => const OverscrollDemo(),
),
new GalleryItem(
title: 'Scrollable tabs',
......@@ -242,7 +242,7 @@ List<GalleryItem> _buildGalleryItems() {
subtitle: 'Temporary message that appears at the bottom',
category: 'Material Components',
routeName: SnackBarDemo.routeName,
buildRoute: (BuildContext context) => new SnackBarDemo(),
buildRoute: (BuildContext context) => const SnackBarDemo(),
),
new GalleryItem(
title: 'Tabs',
......@@ -256,7 +256,7 @@ List<GalleryItem> _buildGalleryItems() {
subtitle: 'Single line of editable text and numbers',
category: 'Material Components',
routeName: TextFormFieldDemo.routeName,
buildRoute: (BuildContext context) => new TextFormFieldDemo(),
buildRoute: (BuildContext context) => const TextFormFieldDemo(),
),
new GalleryItem(
title: 'Tooltips',
......@@ -327,7 +327,7 @@ List<GalleryItem> _buildGalleryItems() {
subtitle: 'Simple recipe browser',
category: 'Demos',
routeName: PestoDemo.routeName,
buildRoute: (BuildContext context) => new PestoDemo(),
buildRoute: (BuildContext context) => const PestoDemo(),
),
);
return true;
......
......@@ -10,5 +10,5 @@ import 'package:flutter/widgets.dart';
import 'gallery/app.dart';
void main() {
runApp(new GalleryApp());
runApp(const GalleryApp());
}
......@@ -14,7 +14,7 @@ void main() {
// We press the "1" and the "2" buttons and check that the display
// reads "12".
testWidgets('Flutter calculator app smoke test', (WidgetTester tester) async {
await tester.pumpWidget(new CalculatorDemo());
await tester.pumpWidget(const CalculatorDemo());
final Finder oneButton = find.widgetWithText(InkResponse, '1');
expect(oneButton, findsOneWidget);
......
......@@ -14,7 +14,7 @@ void main() {
testWidgets('Flutter gallery button example code displays', (WidgetTester tester) async {
// Regression test for https://github.com/flutter/flutter/issues/6147
await tester.pumpWidget(new GalleryApp());
await tester.pumpWidget(const GalleryApp());
await tester.pump(); // see https://github.com/flutter/flutter/issues/1865
await tester.pump(); // triggers a frame
......
......@@ -15,11 +15,11 @@ void main() {
testWidgets('Pesto appbar heroics', (WidgetTester tester) async {
await tester.pumpWidget(
// The bug only manifests itself when the screen's orientation is portrait
new Center(
child: new SizedBox(
const Center(
child: const SizedBox(
width: 400.0,
height: 800.0,
child: new GalleryApp()
child: const GalleryApp()
)
)
);
......@@ -43,7 +43,7 @@ void main() {
});
testWidgets('Pesto can be scrolled all the way down', (WidgetTester tester) async {
await tester.pumpWidget(new GalleryApp());
await tester.pumpWidget(const GalleryApp());
await tester.pump(); // see https://github.com/flutter/flutter/issues/1865
await tester.tap(find.text('Pesto'));
......
......@@ -17,7 +17,7 @@ void main() {
// Regression test for https://github.com/flutter/flutter/pull/5168
testWidgets('update dialog', (WidgetTester tester) async {
await tester.pumpWidget(new GalleryApp(updateUrlFetcher: mockUpdateUrlFetcher));
await tester.pumpWidget(const GalleryApp(updateUrlFetcher: mockUpdateUrlFetcher));
await tester.pump(); // see https://github.com/flutter/flutter/issues/1865
await tester.pump(); // triggers a frame
......
......@@ -39,12 +39,12 @@ class RenderDots extends RenderConstrainedBox {
}
class Dots extends SingleChildRenderObjectWidget {
Dots({ Key key, Widget child }) : super(key: key, child: child);
const Dots({ Key key, Widget child }) : super(key: key, child: child);
@override
RenderDots createRenderObject(BuildContext context) => new RenderDots();
}
void main() {
runApp(new Dots(child: const Center(child: const Text('Touch me!'))));
runApp(const Dots(child: const Center(child: const Text('Touch me!'))));
}
......@@ -5,7 +5,7 @@
import 'package:flutter/material.dart';
class AdaptedListItem extends StatelessWidget {
AdaptedListItem({ Key key, this.name }) : super(key: key);
const AdaptedListItem({ Key key, this.name }) : super(key: key);
final String name;
......@@ -28,7 +28,7 @@ class AdaptedListItem extends StatelessWidget {
}
class AdaptedGridItem extends StatelessWidget {
AdaptedGridItem({ Key key, this.name }) : super(key: key);
const AdaptedGridItem({ Key key, this.name }) : super(key: key);
final String name;
......@@ -69,7 +69,7 @@ const double _kMaxTileWidth = 150.0;
const double _kGridViewBreakpoint = 450.0;
class AdaptiveContainer extends StatelessWidget {
AdaptiveContainer({ Key key, this.names }) : super(key: key);
const AdaptiveContainer({ Key key, this.names }) : super(key: key);
final List<String> names;
......
......@@ -17,7 +17,7 @@ void addFlexChildSolidColor(RenderFlex parent, Color backgroundColor, { int flex
// Solid colour, Widget version
class Rectangle extends StatelessWidget {
Rectangle(this.color, { Key key }) : super(key: key);
const Rectangle(this.color, { Key key }) : super(key: key);
final Color color;
......@@ -41,7 +41,7 @@ void attachWidgetTreeToRenderTree(RenderProxyBox container) {
height: 300.0,
child: new Column(
children: <Widget>[
new Rectangle(const Color(0xFF00FFFF)),
const Rectangle(const Color(0xFF00FFFF)),
new Material(
child: new Container(
padding: const EdgeInsets.all(10.0),
......@@ -66,7 +66,7 @@ void attachWidgetTreeToRenderTree(RenderProxyBox container) {
)
)
),
new Rectangle(const Color(0xFFFFFF00)),
const Rectangle(const Color(0xFFFFFF00)),
],
mainAxisAlignment: MainAxisAlignment.spaceBetween
)
......
......@@ -53,7 +53,7 @@ class StockArrowPainter extends CustomPainter {
}
class StockArrow extends StatelessWidget {
StockArrow({ Key key, this.percentChange }) : super(key: key);
const StockArrow({ Key key, this.percentChange }) : super(key: key);
final double percentChange;
......
......@@ -345,7 +345,7 @@ class _CreateCompanySheet extends StatelessWidget {
// TODO(ianh): Fill this out.
return new Column(
children: <Widget>[
new TextField(
const TextField(
autofocus: true,
decoration: const InputDecoration(
hintText: 'Company Name',
......
......@@ -8,7 +8,7 @@ import 'stock_data.dart';
import 'stock_row.dart';
class StockList extends StatelessWidget {
StockList({ Key key, this.stocks, this.onOpen, this.onShow, this.onAction }) : super(key: key);
const StockList({ Key key, this.stocks, this.onOpen, this.onShow, this.onAction }) : super(key: key);
final List<Stock> stocks;
final StockRowActionCallback onOpen;
......
......@@ -8,7 +8,7 @@ import 'stock_arrow.dart';
import 'stock_data.dart';
class _StockSymbolView extends StatelessWidget {
_StockSymbolView({ this.stock, this.arrow });
const _StockSymbolView({ this.stock, this.arrow });
final Stock stock;
final Widget arrow;
......@@ -63,7 +63,7 @@ class _StockSymbolView extends StatelessWidget {
}
class StockSymbolPage extends StatelessWidget {
StockSymbolPage({ this.stock });
const StockSymbolPage({ this.stock });
final Stock stock;
......@@ -92,7 +92,7 @@ class StockSymbolPage extends StatelessWidget {
}
class StockSymbolBottomSheet extends StatelessWidget {
StockSymbolBottomSheet({ this.stock });
const StockSymbolBottomSheet({ this.stock });
final Stock stock;
......
......@@ -57,7 +57,7 @@ const BoxDecoration _kCupertinoDialogDecoration = const BoxDecoration(
/// * <https://developer.apple.com/ios/human-interface-guidelines/ui-views/alerts/>
class CupertinoDialog extends StatelessWidget {
/// Creates an iOS-style dialog.
CupertinoDialog({
const CupertinoDialog({
Key key,
this.child,
}) : super(key: key);
......@@ -94,7 +94,7 @@ class CupertinoDialog extends StatelessWidget {
/// * <https://developer.apple.com/ios/human-interface-guidelines/ui-views/alerts/>
class CupertinoAlertDialog extends StatelessWidget {
/// Creates an iOS-style alert dialog.
CupertinoAlertDialog({
const CupertinoAlertDialog({
Key key,
this.title,
this.content,
......@@ -233,7 +233,7 @@ const double _kButtonBarHeight = 45.0;
const Color _kButtonDividerColor = const Color(0xFFD5D5D5);
class _CupertinoButtonBar extends StatelessWidget {
_CupertinoButtonBar({
const _CupertinoButtonBar({
Key key,
this.children,
}) : super(key: key);
......
......@@ -140,7 +140,7 @@ class _CupertinoSliderState extends State<CupertinoSlider> with TickerProviderSt
}
class _CupertinoSliderRenderObjectWidget extends LeafRenderObjectWidget {
_CupertinoSliderRenderObjectWidget({
const _CupertinoSliderRenderObjectWidget({
Key key,
this.value,
this.divisions,
......
......@@ -26,7 +26,7 @@ import 'thumb_painter.dart';
/// * <https://developer.apple.com/ios/human-interface-guidelines/ui-controls/switches/>
class CupertinoSwitch extends StatefulWidget {
/// Creates an iOS-style switch.
CupertinoSwitch({
const CupertinoSwitch({
Key key,
@required this.value,
@required this.onChanged,
......@@ -88,7 +88,7 @@ class _CupertinoSwitchState extends State<CupertinoSwitch> with TickerProviderSt
}
class _CupertinoSwitchRenderObjectWidget extends LeafRenderObjectWidget {
_CupertinoSwitchRenderObjectWidget({
const _CupertinoSwitchRenderObjectWidget({
Key key,
this.value,
this.activeColor,
......
......@@ -39,7 +39,7 @@ class AboutListTile extends StatelessWidget {
/// The arguments are all optional. The application name, if omitted, will be
/// derived from the nearest [Title] widget. The version, icon, and legalese
/// values default to the empty string.
AboutListTile({
const AboutListTile({
Key key,
this.icon: const Icon(null),
this.child,
......@@ -210,7 +210,7 @@ class AboutDialog extends StatelessWidget {
/// The arguments are all optional. The application name, if omitted, will be
/// derived from the nearest [Title] widget. The version, icon, and legalese
/// values default to the empty string.
AboutDialog({
const AboutDialog({
Key key,
this.applicationName,
this.applicationVersion,
......
......@@ -171,7 +171,7 @@ class _ModalBottomSheetLayout extends SingleChildLayoutDelegate {
}
class _ModalBottomSheet<T> extends StatefulWidget {
_ModalBottomSheet({ Key key, this.route }) : super(key: key);
const _ModalBottomSheet({ Key key, this.route }) : super(key: key);
final _ModalBottomSheetRoute<T> route;
......
......@@ -126,7 +126,7 @@ class MaterialButton extends StatefulWidget {
///
/// Rather than creating a material button directly, consider using
/// [FlatButton] or [RaisedButton].
MaterialButton({
const MaterialButton({
Key key,
this.colorBrightness,
this.textTheme,
......
......@@ -27,7 +27,7 @@ class ButtonBar extends StatelessWidget {
/// Creates a button bar.
///
/// The alignment argument defaults to [MainAxisAlignment.end].
ButtonBar({
const ButtonBar({
Key key,
this.alignment: MainAxisAlignment.end,
this.mainAxisSize: MainAxisSize.max,
......
......@@ -41,7 +41,7 @@ class Checkbox extends StatefulWidget {
///
/// * [value] determines whether the checkbox is checked.
/// * [onChanged] is called when the value of the checkbox should change.
Checkbox({
const Checkbox({
Key key,
@required this.value,
@required this.onChanged,
......
......@@ -44,7 +44,7 @@ import 'typography.dart';
/// * <https://material.google.com/components/chips.html#chips-contact-chips>
class CircleAvatar extends StatelessWidget {
/// Creates a circle that represents a user.
CircleAvatar({
const CircleAvatar({
Key key,
this.child,
this.backgroundColor,
......
......@@ -607,7 +607,7 @@ class DataTable extends StatelessWidget {
/// [Table], and put the other contents of the cell inside it.)
class TableRowInkWell extends InkResponse {
/// Creates an ink well for a table row.
TableRowInkWell({
const TableRowInkWell({
Key key,
Widget child,
GestureTapCallback onTap,
......@@ -661,7 +661,7 @@ class TableRowInkWell extends InkResponse {
}
class _SortArrow extends StatefulWidget {
_SortArrow({
const _SortArrow({
Key key,
this.visible,
this.down,
......
......@@ -573,7 +573,7 @@ class _YearPickerState extends State<YearPicker> {
}
class _DatePickerDialog extends StatefulWidget {
_DatePickerDialog({
const _DatePickerDialog({
Key key,
this.initialDate,
this.firstDate,
......
......@@ -31,7 +31,7 @@ class Dialog extends StatelessWidget {
/// Creates a dialog.
///
/// Typically used in conjunction with [showDialog].
Dialog({
const Dialog({
Key key,
this.child,
}) : super(key: key);
......@@ -90,7 +90,7 @@ class AlertDialog extends StatelessWidget {
/// Creates an alert dialog.
///
/// Typically used in conjunction with [showDialog].
AlertDialog({
const AlertDialog({
Key key,
this.title,
this.titlePadding,
......@@ -194,7 +194,7 @@ class AlertDialog extends StatelessWidget {
/// * <https://material.google.com/components/dialogs.html#dialogs-simple-dialogs>
class SimpleDialogOption extends StatelessWidget {
/// Creates an option for a [SimpleDialog].
SimpleDialogOption({
const SimpleDialogOption({
Key key,
this.onPressed,
this.child,
......@@ -244,7 +244,7 @@ class SimpleDialog extends StatelessWidget {
/// Creates a simple dialog.
///
/// Typically used in conjunction with [showDialog].
SimpleDialog({
const SimpleDialog({
Key key,
this.title,
this.titlePadding,
......
......@@ -66,7 +66,7 @@ class Drawer extends StatelessWidget {
/// Creates a material design drawer.
///
/// Typically used in the [Scaffold.drawer] property.
Drawer({
const Drawer({
Key key,
this.elevation: 16,
this.child
......
......@@ -90,7 +90,7 @@ class _DropdownScrollBehavior extends ScrollBehavior {
}
class _DropdownMenu<T> extends StatefulWidget {
_DropdownMenu({
const _DropdownMenu({
Key key,
this.route,
}) : super(key: key);
......
......@@ -30,7 +30,7 @@ class FlexibleSpaceBar extends StatefulWidget {
/// Creates a flexible space bar.
///
/// Most commonly used in the [AppBar.flexibleSpace] field.
FlexibleSpaceBar({
const FlexibleSpaceBar({
Key key,
this.title,
this.background,
......@@ -161,7 +161,7 @@ class _FlexibleSpaceBarState extends State<FlexibleSpaceBar> {
}
class _FlexibleSpaceBarSettings extends InheritedWidget {
_FlexibleSpaceBarSettings({
const _FlexibleSpaceBarSettings({
Key key,
this.toolbarOpacity,
this.minExtent,
......
......@@ -24,7 +24,7 @@ class GridTileBar extends StatelessWidget {
/// Creates a grid tile bar.
///
/// Typically used to with [GridTile].
GridTileBar({
const GridTileBar({
Key key,
this.backgroundColor,
this.leading,
......
......@@ -31,7 +31,7 @@ class InkResponse extends StatefulWidget {
/// Creates an area of a [Material] that responds to touch.
///
/// Must have an ancestor [Material] widget in which to cause ink reactions.
InkResponse({
const InkResponse({
Key key,
this.child,
this.onTap,
......@@ -253,7 +253,7 @@ class InkWell extends InkResponse {
/// Creates an ink well.
///
/// Must have an ancestor [Material] widget in which to cause ink reactions.
InkWell({
const InkWell({
Key key,
Widget child,
GestureTapCallback onTap,
......
......@@ -235,7 +235,7 @@ class InputDecoration {
class InputDecorator extends StatelessWidget {
/// Creates a widget that displayes labels and other visual elements similar
/// to a [TextField].
InputDecorator({
const InputDecorator({
Key key,
@required this.decoration,
this.baseStyle,
......
......@@ -358,7 +358,7 @@ class _RenderInkFeatures extends RenderProxyBox implements MaterialInkController
}
class _InkFeatures extends SingleChildRenderObjectWidget {
_InkFeatures({ Key key, this.color, Widget child, @required this.vsync }) : super(key: key, child: child);
const _InkFeatures({ Key key, this.color, Widget child, @required this.vsync }) : super(key: key, child: child);
// This widget must be owned by a MaterialState, which must be provided as the vsync.
// This relationship must be 1:1 and cannot change for the lifetime of the MaterialState.
......
......@@ -95,7 +95,7 @@ class MaterialGap extends MergeableMaterialItem {
/// but otherwise looks the same.
class MergeableMaterial extends StatefulWidget {
/// Creates a mergeable Material list of items.
MergeableMaterial({
const MergeableMaterial({
Key key,
this.mainAxis: Axis.vertical,
this.elevation: 2,
......@@ -615,7 +615,7 @@ class _MergeableMaterialState extends State<MergeableMaterial> with TickerProvid
// The parent hierarchy can change and lead to the slice being
// rebuilt. Using a global key solves the issue.
class _MergeableMaterialSliceKey extends GlobalKey {
const _MergeableMaterialSliceKey(this.value) : super.constructor();
_MergeableMaterialSliceKey(this.value) : super.constructor();
final LocalKey value;
......
......@@ -3,12 +3,12 @@
// found in the LICENSE file.
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
import 'theme.dart';
// Fractional offset from 1/4 screen below the top to fully on screen.
// Fractional offset from 1/4 screen below the top to fully on screen.
final FractionalOffsetTween _kBottomUpTween = new FractionalOffsetTween(
begin: FractionalOffset.bottomLeft,
end: FractionalOffset.topLeft
......
......@@ -46,7 +46,7 @@ class Radio<T> extends StatefulWidget {
///
/// * [value] and [groupValue] together determines whether the radio button is selected.
/// * [onChanged] is when the user selects this radio button.
Radio({
const Radio({
Key key,
@required this.value,
@required this.groupValue,
......
......@@ -36,7 +36,7 @@ class RaisedButton extends StatelessWidget {
///
/// The [child] argument is required and is typically a [Text] widget in all
/// caps.
RaisedButton({
const RaisedButton({
Key key,
@required this.onPressed,
this.color,
......
......@@ -141,7 +141,7 @@ class _ScaffoldLayout extends MultiChildLayoutDelegate {
}
class _FloatingActionButtonTransition extends StatefulWidget {
_FloatingActionButtonTransition({
const _FloatingActionButtonTransition({
Key key,
this.child,
}) : super(key: key);
......@@ -938,7 +938,7 @@ class ScaffoldFeatureController<T extends Widget, U> {
}
class _PersistentBottomSheet extends StatefulWidget {
_PersistentBottomSheet({
const _PersistentBottomSheet({
Key key,
this.animationController,
this.onClosing,
......
......@@ -27,7 +27,7 @@ class Scrollbar extends StatefulWidget {
///
/// The [child] should be a source of [ScrollNotification] notifications,
/// typically a [Scrollable] widget.
Scrollbar({
const Scrollbar({
Key key,
@required this.child,
}) : super(key: key);
......
......@@ -177,7 +177,7 @@ class _SliderState extends State<Slider> with TickerProviderStateMixin {
}
class _SliderRenderObjectWidget extends LeafRenderObjectWidget {
_SliderRenderObjectWidget({
const _SliderRenderObjectWidget({
Key key,
this.value,
this.divisions,
......
......@@ -170,7 +170,7 @@ class TabController extends ChangeNotifier {
}
class _TabControllerScope extends InheritedWidget {
_TabControllerScope({
const _TabControllerScope({
Key key,
this.controller,
this.enabled,
......@@ -227,7 +227,7 @@ class DefaultTabController extends StatefulWidget {
/// The [length] argument must be great than one.
///
/// The [initialIndex] argument must not be null.
DefaultTabController({
const DefaultTabController({
Key key,
@required this.length,
this.initialIndex: 0,
......
......@@ -103,7 +103,7 @@ class Tab extends StatelessWidget {
}
class _TabStyle extends AnimatedWidget {
_TabStyle({
const _TabStyle({
Key key,
Animation<double> animation,
this.selected,
......@@ -946,7 +946,7 @@ class TabPageSelectorIndicator extends StatelessWidget {
/// ancestor.
class TabPageSelector extends StatelessWidget {
/// Creates a compact widget that indicates which tab has been selected.
TabPageSelector({ Key key, this.controller }) : super(key: key);
const TabPageSelector({ Key key, this.controller }) : super(key: key);
/// This widget's selection and animation state.
///
......
......@@ -62,7 +62,7 @@ class TextField extends StatefulWidget {
/// To remove the decoration entirely (including the extra padding introduced
/// by the decoration to save space for the labels), set the [decoration] to
/// null.
TextField({
const TextField({
Key key,
this.controller,
this.focusNode,
......
......@@ -17,7 +17,7 @@ const double _kToolbarScreenPadding = 8.0; // pixels
/// Manages a copy/paste text selection toolbar.
class _TextSelectionToolbar extends StatelessWidget {
_TextSelectionToolbar(this.delegate, {Key key}) : super(key: key);
const _TextSelectionToolbar(this.delegate, {Key key}) : super(key: key);
final TextSelectionDelegate delegate;
TextEditingValue get value => delegate.textEditingValue;
......
......@@ -235,7 +235,7 @@ class _TooltipPositionDelegate extends SingleChildLayoutDelegate {
}
class _TooltipOverlay extends StatelessWidget {
_TooltipOverlay({
const _TooltipOverlay({
Key key,
this.message,
this.height,
......
......@@ -104,7 +104,7 @@ class TwoLevelListItem extends StatelessWidget {
/// * [ListTile]
class TwoLevelSublist extends StatefulWidget {
/// Creates an item in a two-level list that can expland and collapse.
TwoLevelSublist({
const TwoLevelSublist({
Key key,
this.leading,
@required this.title,
......
......@@ -50,7 +50,7 @@ class FlutterLogoDecoration extends Decoration {
// (see https://github.com/dart-lang/sdk/issues/26980 for details about that ignore statement)
_opacity = 1.0;
FlutterLogoDecoration._(this.lightColor, this.darkColor, this.textColor, this.style, this._position, this._opacity, this.margin);
const FlutterLogoDecoration._(this.lightColor, this.darkColor, this.textColor, this.style, this._position, this._opacity, this.margin);
/// The lighter of the two colors used to paint the logo.
///
......
......@@ -532,7 +532,7 @@ enum _IntrinsicDimension { minWidth, maxWidth, minHeight, maxHeight }
@immutable
class _IntrinsicDimensionsCacheEntry {
_IntrinsicDimensionsCacheEntry(this.dimension, this.argument);
const _IntrinsicDimensionsCacheEntry(this.dimension, this.argument);
final _IntrinsicDimension dimension;
final double argument;
......
......@@ -145,7 +145,7 @@ class SliverGridRegularTileLayout extends SliverGridLayout {
///
/// All of the arguments must not be null and must not be negative. The
/// `crossAxisCount` argument must be greater than zero.
SliverGridRegularTileLayout({
const SliverGridRegularTileLayout({
@required this.crossAxisCount,
@required this.mainAxisStride,
@required this.crossAxisStride,
......
......@@ -15,7 +15,7 @@ class AnimatedSize extends SingleChildRenderObjectWidget {
/// Creates a widget that animates its size to match that of its child.
///
/// The [curve] and [duration] arguments must not be null.
AnimatedSize({
const AnimatedSize({
Key key,
Widget child,
this.alignment: FractionalOffset.center,
......
......@@ -223,7 +223,7 @@ class _WidgetsAppState extends State<WidgetsApp> implements WidgetsBindingObserv
performanceOverlay = new PerformanceOverlay.allEnabled(
checkerboardRasterCacheImages: widget.checkerboardRasterCacheImages);
} else if (widget.checkerboardRasterCacheImages) {
performanceOverlay = new PerformanceOverlay(checkerboardRasterCacheImages: true);
performanceOverlay = const PerformanceOverlay(checkerboardRasterCacheImages: true);
}
if (performanceOverlay != null) {
......
......@@ -43,7 +43,7 @@ import 'package:meta/meta.dart' show required;
/// recent interaction is needed for widget building.
abstract class StreamBuilderBase<T, S> extends StatefulWidget {
/// Creates a [StreamBuilderBase] connected to the specified [stream].
StreamBuilderBase({ Key key, this.stream }) : super(key: key);
const StreamBuilderBase({ Key key, this.stream }) : super(key: key);
/// The asynchronous computation to which this builder is currently connected,
/// possibly null. When changed, the current summary is updated using
......
......@@ -1787,7 +1787,7 @@ class Positioned extends ParentDataWidget<Stack> {
/// Creates a Positioned object with [left], [top], [right], and [bottom] set
/// to 0.0 unless a value for them is passed.
Positioned.fill({
const Positioned.fill({
Key key,
this.left: 0.0,
this.top: 0.0,
......
......@@ -83,7 +83,7 @@ class Draggable<T> extends StatefulWidget {
///
/// The [child] and [feedback] arguments must not be null. If
/// [maxSimultaneousDrags] is non-null, it must be non-negative.
Draggable({
const Draggable({
Key key,
@required this.child,
@required this.feedback,
......@@ -95,11 +95,11 @@ class Draggable<T> extends StatefulWidget {
this.maxSimultaneousDrags,
this.onDragStarted,
this.onDraggableCanceled
}) : super(key: key) {
assert(child != null);
assert(feedback != null);
assert(maxSimultaneousDrags == null || maxSimultaneousDrags >= 0);
}
}) : assert(child != null),
assert(feedback != null),
assert(maxSimultaneousDrags == null || maxSimultaneousDrags >= 0),
super(key: key);
/// The data that will be dropped by this draggable.
final T data;
......@@ -207,7 +207,7 @@ class LongPressDraggable<T> extends Draggable<T> {
///
/// The [child] and [feedback] arguments must not be null. If
/// [maxSimultaneousDrags] is non-null, it must be non-negative.
LongPressDraggable({
const LongPressDraggable({
Key key,
@required Widget child,
@required Widget feedback,
......
......@@ -487,7 +487,7 @@ class EditableTextState extends State<EditableText> implements TextInputClient {
}
class _Editable extends LeafRenderObjectWidget {
_Editable({
const _Editable({
Key key,
this.value,
this.style,
......
......@@ -132,7 +132,7 @@ class FormState extends State<Form> {
}
class _FormScope extends InheritedWidget {
_FormScope({
const _FormScope({
Key key,
Widget child,
FormState formState,
......
......@@ -475,7 +475,7 @@ class RawGestureDetectorState extends State<RawGestureDetector> {
}
class _GestureSemantics extends SingleChildRenderObjectWidget {
_GestureSemantics({
const _GestureSemantics({
Key key,
Widget child,
this.owner
......
......@@ -52,7 +52,7 @@ class _GridPaperPainter extends CustomPainter {
/// Useful with a [Stack] for visualizing your layout along a grid.
class GridPaper extends StatelessWidget {
/// Creates a widget that draws a rectilinear grid of 1px wide lines.
GridPaper({
const GridPaper({
Key key,
this.color: const Color(0x7FC3E8F3),
this.interval: 100.0,
......
......@@ -12,7 +12,7 @@ import 'transitions.dart';
/// A widget that prevents the user from interacting with widgets behind itself.
class ModalBarrier extends StatelessWidget {
/// Creates a widget that blocks user interaction.
ModalBarrier({
const ModalBarrier({
Key key,
this.color,
this.dismissible: true
......@@ -50,7 +50,7 @@ class ModalBarrier extends StatelessWidget {
/// A widget that prevents the user from interacting with widgets behind itself.
class AnimatedModalBarrier extends AnimatedWidget {
/// Creates a widget that blocks user interaction.
AnimatedModalBarrier({
const AnimatedModalBarrier({
Key key,
Animation<Color> color,
this.dismissible: true
......
......@@ -86,7 +86,7 @@ abstract class Notification {
/// To dispatch notifications, use the [Notification.dispatch] method.
class NotificationListener<T extends Notification> extends StatelessWidget {
/// Creates a widget that listens for notifications.
NotificationListener({
const NotificationListener({
Key key,
@required this.child,
this.onNotification
......
......@@ -27,7 +27,7 @@ class PerformanceOverlay extends LeafRenderObjectWidget {
/// Create a performance overlay that only displays specific statistics. The
/// mask is created by shifting 1 by the index of the specific
/// [StatisticOption] to enable.
PerformanceOverlay({
const PerformanceOverlay({
Key key,
this.optionsMask: 0,
this.rasterizerThreshold: 0,
......
......@@ -8,7 +8,7 @@ import 'framework.dart';
/// A widget whose child can be mutated.
class Placeholder extends StatefulWidget {
/// Creates a widget whose child can be mutated.
Placeholder({ Key key }) : super(key: key);
const Placeholder({ Key key }) : super(key: key);
@override
PlaceholderState createState() => new PlaceholderState();
......
......@@ -416,7 +416,7 @@ enum RoutePopDisposition {
typedef Future<bool> WillPopCallback();
class _ModalScope extends StatefulWidget {
_ModalScope({
const _ModalScope({
Key key,
this.route,
@required this.page,
......
......@@ -39,7 +39,7 @@ class SizeChangedLayoutNotification extends LayoutChangedNotification { }
class SizeChangedLayoutNotifier extends SingleChildRenderObjectWidget {
/// Creates a [SizeChangedLayoutNotifier] that dispatches layout changed
/// notifications when [child] changes layout size.
SizeChangedLayoutNotifier({
const SizeChangedLayoutNotifier({
Key key,
Widget child
}) : super(key: key, child: child);
......
......@@ -230,12 +230,11 @@ class SliverChildListDelegate extends SliverChildDelegate {
/// Helps subclasses build their children lazily using a [SliverChildDelegate].
abstract class SliverMultiBoxAdaptorWidget extends RenderObjectWidget {
/// Initializes fields for subclasses.
SliverMultiBoxAdaptorWidget({
const SliverMultiBoxAdaptorWidget({
Key key,
@required this.delegate,
}) : super(key: key) {
assert(delegate != null);
}
}) : assert(delegate != null),
super(key: key);
/// The delegate that provides the children for this widget.
///
......@@ -308,7 +307,7 @@ abstract class SliverMultiBoxAdaptorWidget extends RenderObjectWidget {
/// * [SliverGrid], which places its children in arbitrary positions.
class SliverList extends SliverMultiBoxAdaptorWidget {
/// Creates a sliver that places box children in a linear array.
SliverList({
const SliverList({
Key key,
@required SliverChildDelegate delegate,
}) : super(key: key, delegate: delegate);
......@@ -341,7 +340,7 @@ class SliverList extends SliverMultiBoxAdaptorWidget {
class SliverFixedExtentList extends SliverMultiBoxAdaptorWidget {
/// Creates a sliver that places box children with the same main axis extent
/// in a linear array.
SliverFixedExtentList({
const SliverFixedExtentList({
Key key,
@required SliverChildDelegate delegate,
@required this.itemExtent,
......@@ -376,7 +375,7 @@ class SliverFixedExtentList extends SliverMultiBoxAdaptorWidget {
class SliverGrid extends SliverMultiBoxAdaptorWidget {
/// Creates a sliver that places multiple box children in a two dimensional
/// arrangement.
SliverGrid({
const SliverGrid({
Key key,
@required SliverChildDelegate delegate,
@required this.gridDelegate,
......@@ -694,7 +693,7 @@ class SliverMultiBoxAdaptorElement extends RenderObjectElement implements Render
/// * [SliverList], which shows a list of variable-sized children in a
/// viewport.
class SliverFillRemaining extends SingleChildRenderObjectWidget {
SliverFillRemaining({
const SliverFillRemaining({
Key key,
Widget child,
}) : super(key: key, child: child);
......
......@@ -146,12 +146,11 @@ class _SliverPersistentHeaderElement extends RenderObjectElement {
}
abstract class _SliverPersistentHeaderRenderObjectWidget extends RenderObjectWidget {
_SliverPersistentHeaderRenderObjectWidget({
const _SliverPersistentHeaderRenderObjectWidget({
Key key,
@required this.delegate,
}) : super(key: key) {
assert(delegate != null);
}
}) : assert(delegate != null),
super(key: key);
final SliverPersistentHeaderDelegate delegate;
......@@ -190,7 +189,7 @@ abstract class _RenderSliverPersistentHeaderForWidgetsMixin implements RenderSli
}
class _SliverScrollingPersistentHeader extends _SliverPersistentHeaderRenderObjectWidget {
_SliverScrollingPersistentHeader({
const _SliverScrollingPersistentHeader({
Key key,
@required SliverPersistentHeaderDelegate delegate,
}) : super(key: key, delegate: delegate);
......@@ -208,7 +207,7 @@ class _RenderSliverScrollingPersistentHeaderForWidgets extends _RenderSliverScro
with _RenderSliverPersistentHeaderForWidgetsMixin { }
class _SliverPinnedPersistentHeader extends _SliverPersistentHeaderRenderObjectWidget {
_SliverPinnedPersistentHeader({
const _SliverPinnedPersistentHeader({
Key key,
@required SliverPersistentHeaderDelegate delegate,
}) : super(key: key, delegate: delegate);
......@@ -225,7 +224,7 @@ abstract class _RenderSliverPinnedPersistentHeader extends RenderSliverPinnedPer
class _RenderSliverPinnedPersistentHeaderForWidgets extends _RenderSliverPinnedPersistentHeader with _RenderSliverPersistentHeaderForWidgetsMixin { }
class _SliverFloatingPersistentHeader extends _SliverPersistentHeaderRenderObjectWidget {
_SliverFloatingPersistentHeader({
const _SliverFloatingPersistentHeader({
Key key,
@required SliverPersistentHeaderDelegate delegate,
}) : super(key: key, delegate: delegate);
......@@ -250,7 +249,7 @@ abstract class _RenderSliverFloatingPinnedPersistentHeader extends RenderSliverF
class _RenderSliverFloatingPinnedPersistentHeaderForWidgets extends _RenderSliverFloatingPinnedPersistentHeader with _RenderSliverPersistentHeaderForWidgetsMixin { }
class _SliverFloatingPinnedPersistentHeader extends _SliverPersistentHeaderRenderObjectWidget {
_SliverFloatingPinnedPersistentHeader({
const _SliverFloatingPinnedPersistentHeader({
Key key,
@required SliverPersistentHeaderDelegate delegate,
}) : super(key: key, delegate: delegate);
......
......@@ -12,12 +12,11 @@ abstract class StatusTransitionWidget extends StatefulWidget {
/// Initializes fields for subclasses.
///
/// The [animation] argument must not be null.
StatusTransitionWidget({
const StatusTransitionWidget({
Key key,
@required this.animation
}) : super(key: key) {
assert(animation != null);
}
}) : assert(animation != null),
super(key: key);
/// The animation to which this widget is listening.
final Animation<double> animation;
......
......@@ -355,7 +355,7 @@ class _TableElement extends RenderObjectElement {
/// other kinds of widgets, like [RenderObjectWidget]s).
class TableCell extends ParentDataWidget<Table> {
/// Creates a widget that controls how a child of a [Table] is aligned.
TableCell({
const TableCell({
Key key,
this.verticalAlignment,
@required Widget child
......
......@@ -296,7 +296,7 @@ class TextSelectionOverlay implements TextSelectionDelegate {
/// This widget represents a single draggable text selection handle.
class _TextSelectionHandleOverlay extends StatefulWidget {
_TextSelectionHandleOverlay({
const _TextSelectionHandleOverlay({
Key key,
this.selection,
this.position,
......
This diff is collapsed.
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