more const for immutables (#10563)
This commit is contained in:
committed by
GitHub
parent
dfc7788c8e
commit
1eaefe1837
@@ -152,7 +152,7 @@ class ListModel<E> {
|
||||
/// This widget's height is based on the animation parameter, it varies
|
||||
/// from 0 to 128 as the animation varies from 0.0 to 1.0.
|
||||
class CardItem extends StatelessWidget {
|
||||
CardItem({
|
||||
const CardItem({
|
||||
Key key,
|
||||
@required this.animation,
|
||||
this.onTap,
|
||||
|
||||
@@ -68,7 +68,7 @@ final List<Entry> data = <Entry>[
|
||||
// Displays one Entry. If the entry has children then it's displayed
|
||||
// with an ExpansionTile.
|
||||
class EntryItem extends StatelessWidget {
|
||||
EntryItem(this.entry);
|
||||
const EntryItem(this.entry);
|
||||
|
||||
final Entry entry;
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ class _RenderStatusBarPaddingSliver extends RenderSliver {
|
||||
}
|
||||
|
||||
class _StatusBarPaddingSliver extends SingleChildRenderObjectWidget {
|
||||
_StatusBarPaddingSliver({
|
||||
const _StatusBarPaddingSliver({
|
||||
Key key,
|
||||
@required this.maxHeight,
|
||||
this.scrollFactor: 5.0,
|
||||
@@ -369,7 +369,7 @@ class _AllSectionsView extends AnimatedWidget {
|
||||
// app bar's height is _kAppBarMidHeight and only one section heading is
|
||||
// visible.
|
||||
class _SnappingScrollPhysics extends ClampingScrollPhysics {
|
||||
_SnappingScrollPhysics({
|
||||
const _SnappingScrollPhysics({
|
||||
ScrollPhysics parent,
|
||||
@required this.midScrollOffset,
|
||||
}) : assert(midScrollOffset != null),
|
||||
|
||||
@@ -11,7 +11,7 @@ const double kSectionIndicatorWidth = 32.0;
|
||||
|
||||
// The card for a single section. Displays the section's gradient and background image.
|
||||
class SectionCard extends StatelessWidget {
|
||||
SectionCard({ Key key, @required this.section })
|
||||
const SectionCard({ Key key, @required this.section })
|
||||
: assert(section != null),
|
||||
super(key: key);
|
||||
|
||||
@@ -60,7 +60,7 @@ class SectionTitle extends StatelessWidget {
|
||||
color: const Color(0x19000000),
|
||||
);
|
||||
|
||||
SectionTitle({
|
||||
const SectionTitle({
|
||||
Key key,
|
||||
@required this.section,
|
||||
@required this.scale,
|
||||
|
||||
@@ -42,7 +42,7 @@ final List<Palette> allPalettes = <Palette>[
|
||||
|
||||
|
||||
class ColorItem extends StatelessWidget {
|
||||
ColorItem({
|
||||
const ColorItem({
|
||||
Key key,
|
||||
@required this.index,
|
||||
@required this.color,
|
||||
|
||||
@@ -116,7 +116,7 @@ class _ShrineGridDelegate extends SliverGridDelegate {
|
||||
|
||||
// Displays the Vendor's name and avatar.
|
||||
class _VendorItem extends StatelessWidget {
|
||||
_VendorItem({ Key key, @required this.vendor })
|
||||
const _VendorItem({ Key key, @required this.vendor })
|
||||
: assert(vendor != null),
|
||||
super(key: key);
|
||||
|
||||
@@ -294,7 +294,7 @@ class _Heading extends StatelessWidget {
|
||||
// A card that displays a product's image, price, and vendor. The _ProductItem
|
||||
// cards appear in a grid below the heading.
|
||||
class _ProductItem extends StatelessWidget {
|
||||
_ProductItem({ Key key, @required this.product, this.onPressed })
|
||||
const _ProductItem({ Key key, @required this.product, this.onPressed })
|
||||
: assert(product != null),
|
||||
super(key: key);
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import 'shrine_types.dart';
|
||||
|
||||
// Displays the product title's, description, and order quantity dropdown.
|
||||
class _ProductItem extends StatelessWidget {
|
||||
_ProductItem({
|
||||
const _ProductItem({
|
||||
Key key,
|
||||
@required this.product,
|
||||
@required this.quantity,
|
||||
@@ -69,7 +69,7 @@ class _ProductItem extends StatelessWidget {
|
||||
|
||||
// Vendor name and description
|
||||
class _VendorItem extends StatelessWidget {
|
||||
_VendorItem({ Key key, @required this.vendor })
|
||||
const _VendorItem({ Key key, @required this.vendor })
|
||||
: assert(vendor != null),
|
||||
super(key: key);
|
||||
|
||||
@@ -140,7 +140,7 @@ class _HeadingLayout extends MultiChildLayoutDelegate {
|
||||
// Describes a product and vendor in detail, supports specifying
|
||||
// a order quantity (0-5). Appears at the top of the OrderPage.
|
||||
class _Heading extends StatelessWidget {
|
||||
_Heading({
|
||||
const _Heading({
|
||||
Key key,
|
||||
@required this.product,
|
||||
@required this.quantity,
|
||||
|
||||
@@ -15,7 +15,7 @@ enum ShrineAction {
|
||||
}
|
||||
|
||||
class ShrinePage extends StatefulWidget {
|
||||
ShrinePage({
|
||||
const ShrinePage({
|
||||
Key key,
|
||||
@required this.scaffoldKey,
|
||||
@required this.body,
|
||||
|
||||
@@ -6,7 +6,7 @@ import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class TextStyleItem extends StatelessWidget {
|
||||
TextStyleItem({
|
||||
const TextStyleItem({
|
||||
Key key,
|
||||
@required this.name,
|
||||
@required this.style,
|
||||
|
||||
@@ -88,7 +88,7 @@ class _GalleryDrawerHeaderState extends State<GalleryDrawerHeader> {
|
||||
}
|
||||
|
||||
class GalleryDrawer extends StatelessWidget {
|
||||
GalleryDrawer({
|
||||
const GalleryDrawer({
|
||||
Key key,
|
||||
this.useLightTheme,
|
||||
@required this.onThemeChanged,
|
||||
|
||||
@@ -66,7 +66,7 @@ class _AppBarBackground extends StatelessWidget {
|
||||
}
|
||||
|
||||
class GalleryHome extends StatefulWidget {
|
||||
GalleryHome({
|
||||
const GalleryHome({
|
||||
Key key,
|
||||
this.useLightTheme,
|
||||
@required this.onThemeChanged,
|
||||
|
||||
@@ -12,7 +12,7 @@ import '../demo/all.dart';
|
||||
typedef Widget GalleryDemoBuilder();
|
||||
|
||||
class GalleryItem extends StatelessWidget {
|
||||
GalleryItem({
|
||||
const GalleryItem({
|
||||
@required this.title,
|
||||
this.subtitle,
|
||||
@required this.category,
|
||||
|
||||
@@ -12,7 +12,7 @@ import 'package:url_launcher/url_launcher.dart';
|
||||
typedef Future<String> UpdateUrlFetcher();
|
||||
|
||||
class Updater extends StatefulWidget {
|
||||
Updater({ @required this.updateUrlFetcher, this.child, Key key })
|
||||
const Updater({ @required this.updateUrlFetcher, this.child, Key key })
|
||||
: assert(updateUrlFetcher != null),
|
||||
super(key: key);
|
||||
|
||||
|
||||
@@ -19,13 +19,13 @@ class PlatformView extends StatelessWidget {
|
||||
theme: new ThemeData(
|
||||
primarySwatch: Colors.grey,
|
||||
),
|
||||
home: new MyHomePage(title: 'Platform View'),
|
||||
home: const MyHomePage(title: 'Platform View'),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class MyHomePage extends StatefulWidget {
|
||||
MyHomePage({Key key, this.title}) : super(key: key);
|
||||
const MyHomePage({Key key, this.title}) : super(key: key);
|
||||
|
||||
final String title;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user