prefer const constructors (#8316)
This commit is contained in:
committed by
Adam Barth
parent
663862557b
commit
e9a775bf38
@@ -28,9 +28,9 @@ class RenderDots extends RenderConstrainedBox {
|
||||
@override
|
||||
void paint(PaintingContext context, Offset offset) {
|
||||
final Canvas canvas = context.canvas;
|
||||
canvas.drawRect(offset & size, new Paint()..color = new Color(0xFF0000FF));
|
||||
canvas.drawRect(offset & size, new Paint()..color = const Color(0xFF0000FF));
|
||||
|
||||
Paint paint = new Paint()..color = new Color(0xFF00FF00);
|
||||
Paint paint = new Paint()..color = const Color(0xFF00FF00);
|
||||
for (Point point in _dots.values)
|
||||
canvas.drawCircle(point, 50.0, paint);
|
||||
|
||||
|
||||
@@ -165,7 +165,7 @@ class _GestureDemoState extends State<GestureDemo> {
|
||||
left: 0.0,
|
||||
child: new Card(
|
||||
child: new Container(
|
||||
padding: new EdgeInsets.all(4.0),
|
||||
padding: const EdgeInsets.all(4.0),
|
||||
child: new Column(
|
||||
children: <Widget>[
|
||||
new Row(
|
||||
|
||||
@@ -93,7 +93,7 @@ class SectorAppState extends State<SectorApp> {
|
||||
return new Column(
|
||||
children: <Widget>[
|
||||
new Container(
|
||||
padding: new EdgeInsets.symmetric(horizontal: 8.0, vertical: 25.0),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 25.0),
|
||||
child: new Row(
|
||||
children: <Widget>[
|
||||
new RaisedButton(
|
||||
@@ -102,8 +102,8 @@ class SectorAppState extends State<SectorApp> {
|
||||
child: new Row(
|
||||
children: <Widget>[
|
||||
new Container(
|
||||
padding: new EdgeInsets.all(4.0),
|
||||
margin: new EdgeInsets.only(right: 10.0),
|
||||
padding: const EdgeInsets.all(4.0),
|
||||
margin: const EdgeInsets.only(right: 10.0),
|
||||
child: new WidgetToRenderBoxAdapter(renderBox: sectorAddIcon)
|
||||
),
|
||||
new Text('ADD SECTOR'),
|
||||
@@ -117,8 +117,8 @@ class SectorAppState extends State<SectorApp> {
|
||||
child: new Row(
|
||||
children: <Widget>[
|
||||
new Container(
|
||||
padding: new EdgeInsets.all(4.0),
|
||||
margin: new EdgeInsets.only(right: 10.0),
|
||||
padding: const EdgeInsets.all(4.0),
|
||||
margin: const EdgeInsets.only(right: 10.0),
|
||||
child: new WidgetToRenderBoxAdapter(renderBox: sectorRemoveIcon)
|
||||
),
|
||||
new Text('REMOVE SECTOR'),
|
||||
@@ -132,11 +132,11 @@ class SectorAppState extends State<SectorApp> {
|
||||
),
|
||||
new Expanded(
|
||||
child: new Container(
|
||||
margin: new EdgeInsets.all(8.0),
|
||||
margin: const EdgeInsets.all(8.0),
|
||||
decoration: new BoxDecoration(
|
||||
border: new Border.all()
|
||||
),
|
||||
padding: new EdgeInsets.all(8.0),
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: new WidgetToRenderBoxAdapter(
|
||||
renderBox: sectors,
|
||||
onBuild: doUpdates
|
||||
|
||||
@@ -44,8 +44,8 @@ void attachWidgetTreeToRenderTree(RenderProxyBox container) {
|
||||
new Rectangle(const Color(0xFF00FFFF)),
|
||||
new Material(
|
||||
child: new Container(
|
||||
padding: new EdgeInsets.all(10.0),
|
||||
margin: new EdgeInsets.all(10.0),
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
margin: const EdgeInsets.all(10.0),
|
||||
child: new Row(
|
||||
children: <Widget>[
|
||||
new RaisedButton(
|
||||
@@ -99,7 +99,7 @@ void main() {
|
||||
addFlexChildSolidColor(flexRoot, const Color(0xFF0000FF), flex: 1);
|
||||
|
||||
transformBox = new RenderTransform(child: flexRoot, transform: new Matrix4.identity(), alignment: FractionalOffset.center);
|
||||
RenderPadding root = new RenderPadding(padding: new EdgeInsets.all(80.0), child: transformBox);
|
||||
RenderPadding root = new RenderPadding(padding: const EdgeInsets.all(80.0), child: transformBox);
|
||||
|
||||
binding.renderView.child = root;
|
||||
binding.addPersistentFrameCallback(rotate);
|
||||
|
||||
@@ -46,7 +46,7 @@ Widget toStyledText(String name, String text) {
|
||||
style: _kUnderline,
|
||||
text: name
|
||||
),
|
||||
new TextSpan(text: ':')
|
||||
const TextSpan(text: ':')
|
||||
]
|
||||
),
|
||||
new TextSpan(text: text)
|
||||
@@ -108,7 +108,7 @@ class _StyledTextDemoState extends State<StyledTextDemo> {
|
||||
return new GestureDetector(
|
||||
onTap: _handleTap,
|
||||
child: new Container(
|
||||
padding: new EdgeInsets.symmetric(horizontal: 8.0),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8.0),
|
||||
child: new Column(
|
||||
children: children,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
|
||||
Reference in New Issue
Block a user