enable lint unnecessary_const (#19342)

This commit is contained in:
Alexandre Ardhuin
2018-07-16 21:43:48 +02:00
committed by GitHub
parent d10e46ea65
commit cc1cf13eec
556 changed files with 40458 additions and 40457 deletions

View File

@@ -10,7 +10,7 @@ class AnimatedIconsTestApp extends StatelessWidget {
return new MaterialApp(
title: 'Animated Icons Test',
home: const Scaffold(
body: const IconsList(),
body: IconsList(),
),
);
}
@@ -76,27 +76,27 @@ class IconSampleRowState extends State<IconSampleRow> with SingleTickerProviderS
}
}
const List<IconSample> samples = const <IconSample> [
const IconSample(AnimatedIcons.arrow_menu, 'arrow_menu'),
const IconSample(AnimatedIcons.menu_arrow, 'menu_arrow'),
const List<IconSample> samples = <IconSample> [
IconSample(AnimatedIcons.arrow_menu, 'arrow_menu'),
IconSample(AnimatedIcons.menu_arrow, 'menu_arrow'),
const IconSample(AnimatedIcons.close_menu, 'close_menu'),
const IconSample(AnimatedIcons.menu_close, 'menu_close'),
IconSample(AnimatedIcons.close_menu, 'close_menu'),
IconSample(AnimatedIcons.menu_close, 'menu_close'),
const IconSample(AnimatedIcons.home_menu, 'home_menu'),
const IconSample(AnimatedIcons.menu_home, 'menu_home'),
IconSample(AnimatedIcons.home_menu, 'home_menu'),
IconSample(AnimatedIcons.menu_home, 'menu_home'),
const IconSample(AnimatedIcons.play_pause, 'play_pause'),
const IconSample(AnimatedIcons.pause_play, 'pause_play'),
IconSample(AnimatedIcons.play_pause, 'play_pause'),
IconSample(AnimatedIcons.pause_play, 'pause_play'),
const IconSample(AnimatedIcons.list_view, 'list_view'),
const IconSample(AnimatedIcons.view_list, 'view_list'),
IconSample(AnimatedIcons.list_view, 'list_view'),
IconSample(AnimatedIcons.view_list, 'view_list'),
const IconSample(AnimatedIcons.add_event, 'add_event'),
const IconSample(AnimatedIcons.event_add, 'event_add'),
IconSample(AnimatedIcons.add_event, 'add_event'),
IconSample(AnimatedIcons.event_add, 'event_add'),
const IconSample(AnimatedIcons.ellipsis_search, 'ellipsis_search'),
const IconSample(AnimatedIcons.search_ellipsis, 'search_ellipsis'),
IconSample(AnimatedIcons.ellipsis_search, 'ellipsis_search'),
IconSample(AnimatedIcons.search_ellipsis, 'search_ellipsis'),
];
class IconSample {

View File

@@ -26,14 +26,14 @@ class CardCollection extends StatefulWidget {
class CardCollectionState extends State<CardCollection> {
static const TextStyle cardLabelStyle =
const TextStyle(color: Colors.white, fontSize: 18.0, fontWeight: FontWeight.bold);
TextStyle(color: Colors.white, fontSize: 18.0, fontWeight: FontWeight.bold);
// TODO(hansmuller): need a local image asset
static const String _sunshineURL = 'http://www.walltor.com/images/wallpaper/good-morning-sunshine-58540.jpg';
static const double kCardMargins = 8.0;
static const double kFixedCardHeight = 100.0;
static const List<double> _cardHeights = const <double>[
static const List<double> _cardHeights = <double>[
48.0, 63.0, 85.0, 146.0, 60.0, 55.0, 84.0, 96.0, 50.0,
48.0, 63.0, 85.0, 146.0, 60.0, 55.0, 84.0, 96.0, 50.0,
48.0, 63.0, 85.0, 146.0, 60.0, 55.0, 84.0, 96.0, 50.0,
@@ -102,7 +102,7 @@ class CardCollectionState extends State<CardCollection> {
data: const IconThemeData(color: Colors.black),
child: new ListView(
children: <Widget>[
const DrawerHeader(child: const Center(child: const Text('Options'))),
const DrawerHeader(child: Center(child: Text('Options'))),
buildDrawerCheckbox('Make card labels editable', _editable, _toggleEditable),
buildDrawerCheckbox('Fixed size cards', _fixedSizeCards, _toggleFixedSizeCards),
buildDrawerCheckbox('Let the sun shine', _sunshine, _toggleSunshine),
@@ -347,8 +347,8 @@ class CardCollectionState extends State<CardCollection> {
return const LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: const <Color>[const Color(0x00FFFFFF), const Color(0xFFFFFFFF)],
stops: const <double>[0.1, 0.35],
colors: <Color>[Color(0x00FFFFFF), Color(0xFFFFFFFF)],
stops: <double>[0.1, 0.35],
)
.createShader(bounds);
}

View File

@@ -25,25 +25,25 @@ class ColorDemoHome extends StatelessWidget {
new Image.network('https://flutter.github.io/assets-for-api-docs/assets/tests/colors/gbr.png'),
new Image.network('https://flutter.github.io/assets-for-api-docs/assets/tests/colors/tf.png'),
new Image.network('https://flutter.github.io/assets-for-api-docs/assets/tests/colors/wide-gamut.png'),
const GradientRow(leftColor: const Color(0xFFFF0000), rightColor: const Color(0xFF00FF00)),
const GradientRow(leftColor: const Color(0xFF0000FF), rightColor: const Color(0xFFFFFF00)),
const GradientRow(leftColor: const Color(0xFFFF0000), rightColor: const Color(0xFF0000FF)),
const GradientRow(leftColor: const Color(0xFF00FF00), rightColor: const Color(0xFFFFFF00)),
const GradientRow(leftColor: const Color(0xFF0000FF), rightColor: const Color(0xFF00FF00)),
const GradientRow(leftColor: const Color(0xFFFF0000), rightColor: const Color(0xFFFFFF00)),
const GradientRow(leftColor: Color(0xFFFF0000), rightColor: Color(0xFF00FF00)),
const GradientRow(leftColor: Color(0xFF0000FF), rightColor: Color(0xFFFFFF00)),
const GradientRow(leftColor: Color(0xFFFF0000), rightColor: Color(0xFF0000FF)),
const GradientRow(leftColor: Color(0xFF00FF00), rightColor: Color(0xFFFFFF00)),
const GradientRow(leftColor: Color(0xFF0000FF), rightColor: Color(0xFF00FF00)),
const GradientRow(leftColor: Color(0xFFFF0000), rightColor: Color(0xFFFFFF00)),
// For the following pairs, the blend result should match the opaque color.
const ColorRow(color: const Color(0xFFBCBCBC)),
const ColorRow(color: const Color(0x80000000)),
const ColorRow(color: Color(0xFFBCBCBC)),
const ColorRow(color: Color(0x80000000)),
const ColorRow(color: const Color(0xFFFFBCBC)),
const ColorRow(color: const Color(0x80FF0000)),
const ColorRow(color: Color(0xFFFFBCBC)),
const ColorRow(color: Color(0x80FF0000)),
const ColorRow(color: const Color(0xFFBCFFBC)),
const ColorRow(color: const Color(0x8000FF00)),
const ColorRow(color: Color(0xFFBCFFBC)),
const ColorRow(color: Color(0x8000FF00)),
const ColorRow(color: const Color(0xFFBCBCFF)),
const ColorRow(color: const Color(0x800000FF)),
const ColorRow(color: Color(0xFFBCBCFF)),
const ColorRow(color: Color(0x800000FF)),
],
),
);

View File

@@ -193,14 +193,14 @@ class MovableBall extends StatelessWidget {
color: Colors.blue.shade700,
size: kBallSize,
tappable: true,
child: const Center(child: const Text('BALL'))
child: const Center(child: Text('BALL'))
)
);
final Widget dashedBall = new Container(
width: kBallSize,
height: kBallSize,
child: const CustomPaint(
painter: const DashOutlineCirclePainter()
painter: DashOutlineCirclePainter()
)
);
if (position == ballPosition) {

View File

@@ -4,4 +4,4 @@
import 'package:flutter/widgets.dart';
void main() => runApp(const Center(child: const Text('flutter run -t xxx.dart')));
void main() => runApp(const Center(child: Text('flutter run -t xxx.dart')));

View File

@@ -101,7 +101,7 @@ class CardBuilder extends SliverChildDelegate {
final CardTapCallback onTapUp;
static const TextStyle cardLabelStyle =
const TextStyle(color: Colors.white, fontSize: 18.0, fontWeight: FontWeight.bold);
TextStyle(color: Colors.white, fontSize: 18.0, fontWeight: FontWeight.bold);
@override
Widget build(BuildContext context, int index) {

View File

@@ -22,12 +22,12 @@ class PageViewAppState extends State<PageViewApp> {
@override
void initState() {
super.initState();
const List<Size> cardSizes = const <Size>[
const Size(100.0, 300.0),
const Size(300.0, 100.0),
const Size(200.0, 400.0),
const Size(400.0, 400.0),
const Size(300.0, 400.0),
const List<Size> cardSizes = <Size>[
Size(100.0, 300.0),
Size(300.0, 100.0),
Size(200.0, 400.0),
Size(400.0, 400.0),
Size(300.0, 400.0),
];
cardModels = new List<CardModel>.generate(cardSizes.length, (int i) {
@@ -37,7 +37,7 @@ class PageViewAppState extends State<PageViewApp> {
}
static const TextStyle cardLabelStyle =
const TextStyle(color: Colors.white, fontSize: 18.0, fontWeight: FontWeight.bold);
TextStyle(color: Colors.white, fontSize: 18.0, fontWeight: FontWeight.bold);
List<CardModel> cardModels;
Size pageSize = const Size(200.0, 200.0);
@@ -84,7 +84,7 @@ class PageViewAppState extends State<PageViewApp> {
return new Drawer(
child: new ListView(
children: <Widget>[
const DrawerHeader(child: const Center(child: const Text('Options'))),
const DrawerHeader(child: Center(child: Text('Options'))),
new ListTile(
leading: const Icon(Icons.more_horiz),
selected: scrollDirection == Axis.horizontal,

View File

@@ -13,7 +13,7 @@ void main() {
title: const Text('Hardware Key Demo'),
),
body: const Center(
child: const RawKeyboardDemo(),
child: RawKeyboardDemo(),
),
),
));

File diff suppressed because it is too large Load Diff