make @immutable const classes (#9532)

* make @immutable const

* fix build
This commit is contained in:
Alexandre Ardhuin
2017-04-21 23:09:42 +02:00
committed by GitHub
parent 1abb6f5d74
commit 9541848272
166 changed files with 397 additions and 403 deletions

View File

@@ -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!'))));
}

View File

@@ -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;

View File

@@ -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
)