enable lint unnecessary_const (#19342)
This commit is contained in:
committed by
GitHub
parent
d10e46ea65
commit
cc1cf13eec
@@ -4,4 +4,4 @@
|
||||
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
void main() => runApp(const Center(child: const Text('flutter run -t xxx/yyy.dart', textDirection: TextDirection.ltr)));
|
||||
void main() => runApp(const Center(child: Text('flutter run -t xxx/yyy.dart', textDirection: TextDirection.ltr)));
|
||||
|
||||
@@ -13,33 +13,33 @@ void main() {
|
||||
final RenderFlex table = new RenderFlex(direction: Axis.vertical, textDirection: TextDirection.ltr);
|
||||
|
||||
void addAlignmentRow(CrossAxisAlignment crossAxisAlignment) {
|
||||
TextStyle style = const TextStyle(color: const Color(0xFF000000));
|
||||
TextStyle style = const TextStyle(color: Color(0xFF000000));
|
||||
final RenderParagraph paragraph = new RenderParagraph(
|
||||
new TextSpan(style: style, text: '$crossAxisAlignment'),
|
||||
textDirection: TextDirection.ltr,
|
||||
);
|
||||
table.add(new RenderPadding(child: paragraph, padding: const EdgeInsets.only(top: 20.0)));
|
||||
final RenderFlex row = new RenderFlex(crossAxisAlignment: crossAxisAlignment, textBaseline: TextBaseline.alphabetic, textDirection: TextDirection.ltr);
|
||||
style = const TextStyle(fontSize: 15.0, color: const Color(0xFF000000));
|
||||
style = const TextStyle(fontSize: 15.0, color: Color(0xFF000000));
|
||||
row.add(new RenderDecoratedBox(
|
||||
decoration: const BoxDecoration(color: const Color(0x7FFFCCCC)),
|
||||
decoration: const BoxDecoration(color: Color(0x7FFFCCCC)),
|
||||
child: new RenderParagraph(
|
||||
new TextSpan(style: style, text: 'foo foo foo'),
|
||||
textDirection: TextDirection.ltr,
|
||||
),
|
||||
));
|
||||
style = const TextStyle(fontSize: 10.0, color: const Color(0xFF000000));
|
||||
style = const TextStyle(fontSize: 10.0, color: Color(0xFF000000));
|
||||
row.add(new RenderDecoratedBox(
|
||||
decoration: const BoxDecoration(color: const Color(0x7FCCFFCC)),
|
||||
decoration: const BoxDecoration(color: Color(0x7FCCFFCC)),
|
||||
child: new RenderParagraph(
|
||||
new TextSpan(style: style, text: 'foo foo foo'),
|
||||
textDirection: TextDirection.ltr,
|
||||
),
|
||||
));
|
||||
final RenderFlex subrow = new RenderFlex(crossAxisAlignment: crossAxisAlignment, textBaseline: TextBaseline.alphabetic, textDirection: TextDirection.ltr);
|
||||
style = const TextStyle(fontSize: 25.0, color: const Color(0xFF000000));
|
||||
style = const TextStyle(fontSize: 25.0, color: Color(0xFF000000));
|
||||
subrow.add(new RenderDecoratedBox(
|
||||
decoration: const BoxDecoration(color: const Color(0x7FCCCCFF)),
|
||||
decoration: const BoxDecoration(color: Color(0x7FCCCCFF)),
|
||||
child: new RenderParagraph(
|
||||
new TextSpan(style: style, text: 'foo foo foo foo'),
|
||||
textDirection: TextDirection.ltr,
|
||||
@@ -59,7 +59,7 @@ void main() {
|
||||
addAlignmentRow(CrossAxisAlignment.baseline);
|
||||
|
||||
void addJustificationRow(MainAxisAlignment justify) {
|
||||
const TextStyle style = const TextStyle(color: const Color(0xFF000000));
|
||||
const TextStyle style = TextStyle(color: Color(0xFF000000));
|
||||
final RenderParagraph paragraph = new RenderParagraph(
|
||||
new TextSpan(style: style, text: '$justify'),
|
||||
textDirection: TextDirection.ltr,
|
||||
@@ -82,7 +82,7 @@ void main() {
|
||||
addJustificationRow(MainAxisAlignment.spaceAround);
|
||||
|
||||
final RenderDecoratedBox root = new RenderDecoratedBox(
|
||||
decoration: const BoxDecoration(color: const Color(0xFFFFFFFF)),
|
||||
decoration: const BoxDecoration(color: Color(0xFFFFFFFF)),
|
||||
child: new RenderPadding(child: table, padding: const EdgeInsets.symmetric(vertical: 50.0)),
|
||||
);
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ class NonStopVSync implements TickerProvider {
|
||||
void main() {
|
||||
// We first create a render object that represents a green box.
|
||||
final RenderBox green = new RenderDecoratedBox(
|
||||
decoration: const BoxDecoration(color: const Color(0xFF00FF00))
|
||||
decoration: const BoxDecoration(color: Color(0xFF00FF00))
|
||||
);
|
||||
// Second, we wrap that green box in a render object that forces the green box
|
||||
// to have a specific size.
|
||||
|
||||
@@ -577,7 +577,7 @@ class RenderSolidColor extends RenderDecoratedSector {
|
||||
@override
|
||||
void handleEvent(PointerEvent event, HitTestEntry entry) {
|
||||
if (event is PointerDownEvent) {
|
||||
decoration = const BoxDecoration(color: const Color(0xFFFF0000));
|
||||
decoration = const BoxDecoration(color: Color(0xFFFF0000));
|
||||
} else if (event is PointerUpEvent) {
|
||||
decoration = new BoxDecoration(color: backgroundColor);
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ class RenderSolidColorBox extends RenderDecoratedBox {
|
||||
@override
|
||||
void handleEvent(PointerEvent event, BoxHitTestEntry entry) {
|
||||
if (event is PointerDownEvent) {
|
||||
decoration = const BoxDecoration(color: const Color(0xFFFF0000));
|
||||
decoration = const BoxDecoration(color: Color(0xFFFF0000));
|
||||
} else if (event is PointerUpEvent) {
|
||||
decoration = new BoxDecoration(color: backgroundColor);
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ void main() {
|
||||
// Create some styled text to tell the user to interact with the app.
|
||||
final RenderParagraph paragraph = new RenderParagraph(
|
||||
const TextSpan(
|
||||
style: const TextStyle(color: Colors.black87),
|
||||
style: TextStyle(color: Colors.black87),
|
||||
text: 'Touch me!',
|
||||
),
|
||||
textDirection: TextDirection.ltr,
|
||||
|
||||
@@ -47,8 +47,8 @@ void main() {
|
||||
runApp(
|
||||
const Directionality(
|
||||
textDirection: TextDirection.ltr,
|
||||
child: const Center(
|
||||
child: const LifecycleWatcher(),
|
||||
child: Center(
|
||||
child: LifecycleWatcher(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -49,9 +49,9 @@ void main() {
|
||||
runApp(
|
||||
const Directionality(
|
||||
textDirection: TextDirection.ltr,
|
||||
child: const Dots(
|
||||
child: const Center(
|
||||
child: const Text('Touch me!'),
|
||||
child: Dots(
|
||||
child: Center(
|
||||
child: Text('Touch me!'),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -69,7 +69,7 @@ class GestureDemoState extends State<GestureDemo> {
|
||||
double _previousZoom;
|
||||
double _zoom = 1.0;
|
||||
|
||||
static const List<MaterialColor> kSwatches = const <MaterialColor>[
|
||||
static const List<MaterialColor> kSwatches = <MaterialColor>[
|
||||
Colors.red,
|
||||
Colors.pink,
|
||||
Colors.purple,
|
||||
|
||||
@@ -4,4 +4,4 @@
|
||||
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
void main() => runApp(const Center(child: const Text('Hello, world!', textDirection: TextDirection.ltr)));
|
||||
void main() => runApp(const Center(child: Text('Hello, world!', textDirection: TextDirection.ltr)));
|
||||
|
||||
@@ -48,7 +48,7 @@ class AdaptedGridItem extends StatelessWidget {
|
||||
child: new Text(name)
|
||||
),
|
||||
const IconButton(
|
||||
icon: const Icon(Icons.more_vert),
|
||||
icon: Icon(Icons.more_vert),
|
||||
onPressed: null
|
||||
)
|
||||
]
|
||||
|
||||
@@ -43,7 +43,7 @@ void attachWidgetTreeToRenderTree(RenderProxyBox container) {
|
||||
height: 300.0,
|
||||
child: new Column(
|
||||
children: <Widget>[
|
||||
const Rectangle(const Color(0xFF00FFFF)),
|
||||
const Rectangle(Color(0xFF00FFFF)),
|
||||
new Material(
|
||||
child: new Container(
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
@@ -68,7 +68,7 @@ void attachWidgetTreeToRenderTree(RenderProxyBox container) {
|
||||
),
|
||||
),
|
||||
),
|
||||
const Rectangle(const Color(0xFFFFFF00)),
|
||||
const Rectangle(Color(0xFFFFFF00)),
|
||||
],
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
),
|
||||
|
||||
@@ -25,10 +25,10 @@ final List<List<String>> _kNameLines = _kDialogText
|
||||
|
||||
final TextStyle _kDaveStyle = new TextStyle(color: Colors.indigo.shade400, height: 1.8);
|
||||
final TextStyle _kHalStyle = new TextStyle(color: Colors.red.shade400, fontFamily: 'monospace');
|
||||
const TextStyle _kBold = const TextStyle(fontWeight: FontWeight.bold);
|
||||
const TextStyle _kUnderline = const TextStyle(
|
||||
const TextStyle _kBold = TextStyle(fontWeight: FontWeight.bold);
|
||||
const TextStyle _kUnderline = TextStyle(
|
||||
decoration: TextDecoration.underline,
|
||||
decorationColor: const Color(0xFF000000),
|
||||
decorationColor: Color(0xFF000000),
|
||||
decorationStyle: TextDecorationStyle.wavy
|
||||
);
|
||||
|
||||
@@ -64,8 +64,8 @@ class SpeakerSeparator extends StatelessWidget {
|
||||
constraints: const BoxConstraints.expand(height: 0.0),
|
||||
margin: const EdgeInsets.symmetric(vertical: 10.0, horizontal: 64.0),
|
||||
decoration: const BoxDecoration(
|
||||
border: const Border(
|
||||
bottom: const BorderSide(color: const Color.fromARGB(24, 0, 0, 0))
|
||||
border: Border(
|
||||
bottom: BorderSide(color: Color.fromARGB(24, 0, 0, 0))
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user