Add missing trailing commas (#28673) * add trailing commas on list/map/parameters * add trailing commas on Invocation with nb of arg>1 * add commas for widget containing widgets * add trailing commas if instantiation contains trailing comma * revert bad change
diff --git a/dev/manual_tests/lib/card_collection.dart b/dev/manual_tests/lib/card_collection.dart index 896ec52..3c06421 100644 --- a/dev/manual_tests/lib/card_collection.dart +++ b/dev/manual_tests/lib/card_collection.dart
@@ -56,14 +56,14 @@ (int i) { _cardModels[i].height = _editable ? max(_cardHeights[i], 60.0) : _cardHeights[i]; return _cardModels[i]; - } + }, ); } void _initVariableSizedCardModels() { _cardModels = List<CardModel>.generate( _cardHeights.length, - (int i) => CardModel(i, _editable ? max(_cardHeights[i], 60.0) : _cardHeights[i]) + (int i) => CardModel(i, _editable ? max(_cardHeights[i], 60.0) : _cardHeights[i]), ); } @@ -234,7 +234,7 @@ Widget _buildAppBar(BuildContext context) { return AppBar( actions: <Widget>[ - Text(_dismissDirectionText(_dismissDirection)) + Text(_dismissDirectionText(_dismissDirection)), ], flexibleSpace: Container( padding: const EdgeInsets.only(left: 72.0),
diff --git a/dev/manual_tests/lib/drag_and_drop.dart b/dev/manual_tests/lib/drag_and_drop.dart index cc27bf7..d825c52 100644 --- a/dev/manual_tests/lib/drag_and_drop.dart +++ b/dev/manual_tests/lib/drag_and_drop.dart
@@ -32,11 +32,11 @@ color: data.isEmpty ? _color : Colors.grey.shade200, border: Border.all( width: 3.0, - color: data.isEmpty ? Colors.white : Colors.blue + color: data.isEmpty ? Colors.white : Colors.blue, ), - ) + ), ); - } + }, ); } } @@ -65,10 +65,10 @@ decoration: BoxDecoration( color: widget.color, border: Border.all(width: taps.toDouble()), - shape: BoxShape.circle + shape: BoxShape.circle, ), - child: widget.child - ) + child: widget.child, + ), ); } } @@ -79,7 +79,7 @@ this.color, this.heavy = false, this.under = true, - this.child + this.child, }) : super(key: key); final Color color; @@ -103,13 +103,13 @@ child: Dot( color: color, size: size, - child: Center(child: child) - ) + child: Center(child: child), + ), ); Widget feedback = Opacity( opacity: 0.75, - child: contents + child: contents, ); Offset feedbackOffset; @@ -118,7 +118,7 @@ feedback = Transform( transform: Matrix4.identity() ..translate(-size / 2.0, -(size / 2.0 + kFingerSize)), - child: feedback + child: feedback, ); feedbackOffset = const Offset(0.0, -kFingerSize); anchor = DragAnchor.pointer; @@ -133,7 +133,7 @@ child: contents, feedback: feedback, feedbackOffset: feedbackOffset, - dragAnchor: anchor + dragAnchor: anchor, ); } else { return Draggable<Color>( @@ -141,7 +141,7 @@ child: contents, feedback: feedback, feedbackOffset: feedbackOffset, - dragAnchor: anchor + dragAnchor: anchor, ); } } @@ -193,15 +193,15 @@ color: Colors.blue.shade700, size: kBallSize, tappable: true, - child: const Center(child: Text('BALL')) - ) + child: const Center(child: Text('BALL')), + ), ); final Widget dashedBall = Container( width: kBallSize, height: kBallSize, child: const CustomPaint( painter: DashOutlineCirclePainter() - ) + ), ); if (position == ballPosition) { return Draggable<bool>( @@ -209,14 +209,14 @@ child: ball, childWhenDragging: dashedBall, feedback: ball, - maxSimultaneousDrags: 1 + maxSimultaneousDrags: 1, ); } else { return DragTarget<bool>( onAccept: (bool data) { callback(position); }, builder: (BuildContext context, List<bool> accepted, List<dynamic> rejected) { return dashedBall; - } + }, ); } } @@ -238,7 +238,7 @@ Widget build(BuildContext context) { return Scaffold( appBar: AppBar( - title: const Text('Drag and Drop Flutter Demo') + title: const Text('Drag and Drop Flutter Demo'), ), body: Column( children: <Widget>[ @@ -251,22 +251,22 @@ color: Colors.yellow.shade300, under: true, heavy: false, - child: const Text('under') + child: const Text('under'), ), ExampleDragSource( color: Colors.green.shade300, under: false, heavy: true, - child: const Text('long-press above') + child: const Text('long-press above'), ), ExampleDragSource( color: Colors.indigo.shade300, under: false, heavy: false, - child: const Text('above') + child: const Text('above'), ), ], - ) + ), ), Expanded( child: Row( @@ -275,8 +275,8 @@ Expanded(child: ExampleDragTarget()), Expanded(child: ExampleDragTarget()), Expanded(child: ExampleDragTarget()), - ] - ) + ], + ), ), Expanded( child: Row( @@ -286,10 +286,10 @@ MovableBall(2, position, moveBall), MovableBall(3, position, moveBall), ], - ) + ), ), - ] - ) + ], + ), ); } } @@ -297,6 +297,6 @@ void main() { runApp(MaterialApp( title: 'Drag and Drop Flutter Demo', - home: DragAndDropApp() + home: DragAndDropApp(), )); }
diff --git a/dev/manual_tests/lib/material_arc.dart b/dev/manual_tests/lib/material_arc.dart index 23fae24..5e16d64 100644 --- a/dev/manual_tests/lib/material_arc.dart +++ b/dev/manual_tests/lib/material_arc.dart
@@ -48,7 +48,7 @@ class _PointDemoPainter extends CustomPainter { _PointDemoPainter({ Animation<double> repaint, - this.arc + this.arc, }) : _repaint = repaint, super(repaint: repaint); final MaterialPointArcTween arc; @@ -202,7 +202,7 @@ key: _painterKey, foregroundPainter: _PointDemoPainter( repaint: _animation, - arc: arc + arc: arc, ), // Watch out: if this IgnorePointer is left out, then gestures that // fail _PointDemoPainter.hitTest() will still be recognized because @@ -213,12 +213,12 @@ child: Text( 'Tap the refresh button to run the animation. Drag the green ' "and red points to change the animation's path.", - style: Theme.of(context).textTheme.caption.copyWith(fontSize: 16.0) - ) - ) - ) - ) - ) + style: Theme.of(context).textTheme.caption.copyWith(fontSize: 16.0), + ), + ), + ), + ), + ), ); } } @@ -226,7 +226,7 @@ class _RectangleDemoPainter extends CustomPainter { _RectangleDemoPainter({ Animation<double> repaint, - this.arc + this.arc, }) : _repaint = repaint, super(repaint: repaint); final MaterialRectArcTween arc; @@ -350,11 +350,11 @@ _screenSize = screenSize; _begin = Rect.fromLTWH( screenSize.width * 0.5, screenSize.height * 0.2, - screenSize.width * 0.4, screenSize.height * 0.2 + screenSize.width * 0.4, screenSize.height * 0.2, ); _end = Rect.fromLTWH( screenSize.width * 0.1, screenSize.height * 0.4, - screenSize.width * 0.3, screenSize.height * 0.3 + screenSize.width * 0.3, screenSize.height * 0.3, ); } @@ -375,7 +375,7 @@ key: _painterKey, foregroundPainter: _RectangleDemoPainter( repaint: _animation, - arc: arc + arc: arc, ), // Watch out: if this IgnorePointer is left out, then gestures that // fail _RectDemoPainter.hitTest() will still be recognized because @@ -386,12 +386,12 @@ child: Text( 'Tap the refresh button to run the animation. Drag the rectangles ' "to change the animation's path.", - style: Theme.of(context).textTheme.caption.copyWith(fontSize: 16.0) - ) - ) - ) - ) - ) + style: Theme.of(context).textTheme.caption.copyWith(fontSize: 16.0), + ), + ), + ), + ), + ), ); } } @@ -426,13 +426,13 @@ _ArcDemo('POINT', (_ArcDemo demo) { return _PointDemo( key: demo.key, - controller: demo.controller + controller: demo.controller, ); }, this), _ArcDemo('RECTANGLE', (_ArcDemo demo) { return _RectangleDemo( key: demo.key, - controller: demo.controller + controller: demo.controller, ); }, this), ]; @@ -466,9 +466,9 @@ }, ), body: TabBarView( - children: _allDemos.map<Widget>((_ArcDemo demo) => demo.builder(demo)).toList() - ) - ) + children: _allDemos.map<Widget>((_ArcDemo demo) => demo.builder(demo)).toList(), + ), + ), ); } }
diff --git a/dev/manual_tests/lib/text.dart b/dev/manual_tests/lib/text.dart index 0244f3e..d6309bf 100644 --- a/dev/manual_tests/lib/text.dart +++ b/dev/manual_tests/lib/text.dart
@@ -515,7 +515,7 @@ debugPrint(_textSpan.toStringDeep()); } }); - } + }, ), ), ], @@ -573,7 +573,7 @@ ), child: ListBody( children: lines, - ) + ), ), ), ), @@ -668,7 +668,7 @@ child: ListBody( children: lines, ), - ) + ), ), ), ),