add missing trailing commas (#81406)

This commit is contained in:
Alexandre Ardhuin 2021-04-28 22:54:49 +02:00 committed by GitHub
parent 7c27db3dfe
commit 7f31861914
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 131 additions and 93 deletions

View file

@ -68,7 +68,8 @@ class _MyHomePageState extends State<MyHomePage> {
child: Center(
child: Text(
'Platform button tapped $_counter time${ _counter == 1 ? '' : 's' }.',
style: const TextStyle(fontSize: 17.0)),
style: const TextStyle(fontSize: 17.0),
),
),
),
Container(

View file

@ -10,7 +10,7 @@ void main() =>
child:
Text('Hello, world!',
key: Key('title'),
textDirection: TextDirection.ltr
)
)
textDirection: TextDirection.ltr,
),
),
);

View file

@ -83,7 +83,7 @@ class MyHttpOverrides extends HttpOverrides {
@override
HttpClient createHttpClient(SecurityContext? context) {
return super.createHttpClient(
(context ?? SecurityContext())..setTrustedCertificatesBytes(certificate.codeUnits)
(context ?? SecurityContext())..setTrustedCertificatesBytes(certificate.codeUnits),
);
}
}
@ -189,11 +189,13 @@ class _MyHomePageState extends State<MyHomePage> with TickerProviderStateMixin {
Completer<bool>(),
];
final List<Future<bool>> futures = completers.map(
(Completer<bool> completer) => completer.future).toList();
(Completer<bool> completer) => completer.future,
).toList();
final DateTime started = DateTime.now();
Future.wait(futures).then((_) {
print(
'===image_list=== all loaded in ${DateTime.now().difference(started).inMilliseconds}ms.');
'===image_list=== all loaded in ${DateTime.now().difference(started).inMilliseconds}ms.',
);
});
return Scaffold(
appBar: AppBar(
@ -222,16 +224,21 @@ class _MyHomePageState extends State<MyHomePage> with TickerProviderStateMixin {
);
}
List<Widget> createImageList(int count, List<Completer<bool>> completers,
List<AnimationController> controllers) {
List<Widget> createImageList(
int count,
List<Completer<bool>> completers,
List<AnimationController> controllers,
) {
final List<Widget> list = <Widget>[];
for (int i = 0; i < count; i++) {
list.add(Flexible(
fit: FlexFit.tight,
flex: i + 1,
child: RotationTransition(
turns: controllers[i],
child: createImage(i + 1, completers[i]))));
fit: FlexFit.tight,
flex: i + 1,
child: RotationTransition(
turns: controllers[i],
child: createImage(i + 1, completers[i]),
),
));
}
return list;
}

View file

@ -16,8 +16,9 @@ Future<void> beginFrame(Duration timeStamp) async {
final ui.Paint backgroundPaint = ui.Paint()..color = Colors.white;
canvas.drawRect(paintBounds, backgroundPaint);
await const DefaultShaderWarmUp(
drawCallSpacing: 80.0, canvasSize: ui.Size(1024, 1024))
.warmUpOnCanvas(canvas);
drawCallSpacing: 80.0,
canvasSize: ui.Size(1024, 1024),
).warmUpOnCanvas(canvas);
final ui.Picture picture = recorder.endRecording();
// COMPOSITE

View file

@ -29,8 +29,10 @@ void beginFrame(Duration timeStamp) {
final double t = timeStamp.inMicroseconds / Duration.microsecondsPerMillisecond / 1800.0;
canvas.rotate(math.pi * (t % 1.0));
canvas.drawRect(const ui.Rect.fromLTRB(-100.0, -100.0, 100.0, 100.0),
ui.Paint()..color = const ui.Color.fromARGB(255, 0, 255, 0));
canvas.drawRect(
const ui.Rect.fromLTRB(-100.0, -100.0, 100.0, 100.0),
ui.Paint()..color = const ui.Color.fromARGB(255, 0, 255, 0),
);
final ui.Picture picture = recorder.endRecording();
// COMPOSITE

View file

@ -19,8 +19,10 @@ ui.Picture paint(ui.Rect paintBounds) {
final ui.Size logicalSize = ui.window.physicalSize / devicePixelRatio;
canvas.translate(logicalSize.width / 2.0, logicalSize.height / 2.0);
canvas.drawRect(const ui.Rect.fromLTRB(-100.0, -100.0, 100.0, 100.0),
ui.Paint()..color = const ui.Color.fromARGB(255, 0, 255, 0));
canvas.drawRect(
const ui.Rect.fromLTRB(-100.0, -100.0, 100.0, 100.0),
ui.Paint()..color = const ui.Color.fromARGB(255, 0, 255, 0),
);
// The paint method of Paragraph draws the contents of the paragraph onto the
// given canvas.

View file

@ -20,7 +20,7 @@ class NonStopVSync implements TickerProvider {
void main() {
// We first create a render object that represents a green box.
final RenderBox green = RenderDecoratedBox(
decoration: const BoxDecoration(color: 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.

View file

@ -40,7 +40,7 @@ class Calculator {
if (key is int && i++ % _NOTIFY_INTERVAL == 0)
onProgressListener(i.toDouble(), _NUM_ITEMS.toDouble());
return value;
}
},
);
try {
final List<dynamic> result = decoder.convert(_data) as List<dynamic>;
@ -249,7 +249,7 @@ class IsolateExampleState extends State<StatefulWidget> with SingleTickerProvide
Opacity(
opacity: _calculationManager.isRunning ? 1.0 : 0.0,
child: CircularProgressIndicator(
value: _progress
value: _progress,
),
),
Text(_status),

View file

@ -30,8 +30,9 @@ class _GesturePainter extends CustomPainter {
final Offset center = size.center(Offset.zero) * zoom + offset;
final double radius = size.width / 2.0 * zoom;
final Gradient gradient = RadialGradient(
colors: forward ? <Color>[swatch.shade50, swatch.shade900]
: <Color>[swatch.shade900, swatch.shade50]
colors: forward
? <Color>[swatch.shade50, swatch.shade900]
: <Color>[swatch.shade900, swatch.shade50],
);
final Paint paint = Paint()
..shader = gradient.createShader(Rect.fromCircle(

View file

@ -135,7 +135,7 @@ class SectorAppState extends State<SectorApp> {
child: Container(
margin: const EdgeInsets.all(8.0),
decoration: BoxDecoration(
border: Border.all()
border: Border.all(),
),
padding: const EdgeInsets.all(8.0),
child: WidgetToRenderBoxAdapter(

View file

@ -67,8 +67,8 @@ class SpeakerSeparator extends StatelessWidget {
margin: const EdgeInsets.symmetric(vertical: 10.0, horizontal: 64.0),
decoration: const BoxDecoration(
border: Border(
bottom: BorderSide(color: Color.fromARGB(24, 0, 0, 0))
)
bottom: BorderSide(color: Color.fromARGB(24, 0, 0, 0)),
),
),
);
}

View file

@ -75,10 +75,11 @@ class _MyHomePageState extends State<MyHomePage> {
Padding(
padding: const EdgeInsets.all(18.0),
child: ElevatedButton(
child: Platform.isIOS
? const Text('Continue in iOS view')
: const Text('Continue in Android view'),
onPressed: _launchPlatformCount),
child: Platform.isIOS
? const Text('Continue in iOS view')
: const Text('Continue in Android view'),
onPressed: _launchPlatformCount,
),
),
],
),
@ -88,8 +89,7 @@ class _MyHomePageState extends State<MyHomePage> {
padding: const EdgeInsets.only(bottom: 15.0, left: 5.0),
child: Row(
children: <Widget>[
Image.asset('assets/flutter-mark-square-64.png',
scale: 1.5),
Image.asset('assets/flutter-mark-square-64.png', scale: 1.5),
const Text(
'Flutter',
style: TextStyle(fontSize: 30.0),

View file

@ -1199,8 +1199,10 @@ class _RenderCupertinoDialog extends RenderBox {
// Set the position of the actions box to sit at the bottom of the dialog.
// The content box defaults to the top left, which is where we want it.
assert((!isActionSheet && actionsSection!.parentData is BoxParentData)
|| (isActionSheet && actionsSection!.parentData is MultiChildLayoutParentData));
assert(
(!isActionSheet && actionsSection!.parentData is BoxParentData) ||
(isActionSheet && actionsSection!.parentData is MultiChildLayoutParentData),
);
if (isActionSheet) {
final MultiChildLayoutParentData actionParentData = actionsSection!.parentData! as MultiChildLayoutParentData;
actionParentData.offset = Offset(0.0, dialogSizes.contentHeight + dialogSizes.dividerThickness);
@ -1880,8 +1882,7 @@ class _CupertinoDialogActionsRenderWidget extends MultiChildRenderObjectWidget {
}
@override
void updateRenderObject(
BuildContext context, _RenderCupertinoDialogActions renderObject) {
void updateRenderObject(BuildContext context, _RenderCupertinoDialogActions renderObject) {
renderObject
..dialogWidth = _isActionSheet
? null
@ -2226,7 +2227,7 @@ class _RenderCupertinoDialogActions extends RenderBox
);
return constraints.constrain(
Size(dialogWidth!, childSize.height)
Size(dialogWidth!, childSize.height),
);
} else {
// Each button gets half the available width, minus a single divider.

View file

@ -812,7 +812,8 @@ class _AppBarState extends State<AppBar> {
states,
widget.backgroundColor,
appBarTheme.backgroundColor,
colorScheme.brightness == Brightness.dark ? colorScheme.surface : colorScheme.primary);
colorScheme.brightness == Brightness.dark ? colorScheme.surface : colorScheme.primary,
);
final Color foregroundColor = widget.foregroundColor
?? appBarTheme.foregroundColor

View file

@ -651,7 +651,8 @@ class _PopupMenuRouteLayout extends SingleChildLayoutDelegate {
// The menu can be at most the size of the overlay minus 8.0 pixels in each
// direction.
return BoxConstraints.loose(constraints.biggest).deflate(
const EdgeInsets.all(_kMenuScreenPadding) + EdgeInsets.only(top: topPadding, bottom: bottomPadding));
const EdgeInsets.all(_kMenuScreenPadding) + EdgeInsets.only(top: topPadding, bottom: bottomPadding),
);
}
@override

View file

@ -830,7 +830,7 @@ class TextStyle with Diagnosticable {
decorationStyle: decorationStyle ?? this.decorationStyle,
decorationThickness: decorationThickness ?? this.decorationThickness,
debugLabel: newDebugLabel,
overflow: overflow ?? this.overflow
overflow: overflow ?? this.overflow,
);
}

View file

@ -119,7 +119,7 @@ mixin ServicesBinding on BindingBase, SchedulerBinding {
List<int> bytes = licenseBytes.buffer.asUint8List();
bytes = gzip.decode(bytes);
return utf8.decode(bytes);
}()
}(),
);
}, Priority.animation);
await rawLicenses.future;

View file

@ -148,8 +148,7 @@ class LogicalKeyboardKey extends KeyboardKey {
// Equivalent to assert(divisorForValueMask == (1 << valueMaskWidth)).
const int _firstDivisorWidth = 28;
assert(divisorForValueMask ==
(1 << _firstDivisorWidth) * (1 << (valueMaskWidth - _firstDivisorWidth)));
assert(divisorForValueMask == (1 << _firstDivisorWidth) * (1 << (valueMaskWidth - _firstDivisorWidth)));
// JS only supports up to 2^53 - 1, therefore non-value bits can only
// contain (maxSafeIntegerWidth - valueMaskWidth) bits.

View file

@ -505,7 +505,7 @@ class RawAutocomplete<T extends Object> extends StatefulWidget {
assert((focusNode == null) == (textEditingController == null)),
assert(
!(textEditingController != null && initialValue != null),
'textEditingController and initialValue cannot be simultaneously defined.'
'textEditingController and initialValue cannot be simultaneously defined.',
),
super(key: key);

View file

@ -153,10 +153,13 @@ class InteractiveViewer extends StatefulWidget {
assert(scaleEnabled != null),
// boundaryMargin must be either fully infinite or fully finite, but not
// a mix of both.
assert((boundaryMargin.horizontal.isInfinite
&& boundaryMargin.vertical.isInfinite) || (boundaryMargin.top.isFinite
&& boundaryMargin.right.isFinite && boundaryMargin.bottom.isFinite
&& boundaryMargin.left.isFinite)),
assert(
(boundaryMargin.horizontal.isInfinite && boundaryMargin.vertical.isInfinite) ||
(boundaryMargin.top.isFinite &&
boundaryMargin.right.isFinite &&
boundaryMargin.bottom.isFinite &&
boundaryMargin.left.isFinite),
),
constrained = false,
child = null,
super(key: key);

View file

@ -79,7 +79,7 @@ class ScrollBehavior {
/// instead.
@Deprecated(
'Migrate to buildOverscrollIndicator. '
'This feature was deprecated after v2.1.0-11.0.pre.'
'This feature was deprecated after v2.1.0-11.0.pre.',
)
Widget buildViewportChrome(BuildContext context, Widget child, AxisDirection axisDirection) {
switch (getPlatform(context)) {

View file

@ -298,7 +298,8 @@ class LogicalKeySet extends KeySet<LogicalKeyboardKey> with Diagnosticable
@override
Iterable<LogicalKeyboardKey> get triggers => _triggers;
late final Set<LogicalKeyboardKey> _triggers = keys.expand(
(LogicalKeyboardKey key) => _unmapSynonyms[key] ?? <LogicalKeyboardKey>[key]).toSet();
(LogicalKeyboardKey key) => _unmapSynonyms[key] ?? <LogicalKeyboardKey>[key],
).toSet();
@override
bool accepts(RawKeyEvent event, RawKeyboard state) {
@ -475,18 +476,20 @@ class SingleActivator with Diagnosticable implements ShortcutActivator {
// since const constructors can not call functions such as `==` or
// `Set.contains`. Checking with `identical` is sufficient since
// `LogicalKeyboardKey` only provides cached values.
assert(!identical(trigger, LogicalKeyboardKey.control)
&& !identical(trigger, LogicalKeyboardKey.controlLeft)
&& !identical(trigger, LogicalKeyboardKey.controlRight)
&& !identical(trigger, LogicalKeyboardKey.shift)
&& !identical(trigger, LogicalKeyboardKey.shiftLeft)
&& !identical(trigger, LogicalKeyboardKey.shiftRight)
&& !identical(trigger, LogicalKeyboardKey.alt)
&& !identical(trigger, LogicalKeyboardKey.altLeft)
&& !identical(trigger, LogicalKeyboardKey.altRight)
&& !identical(trigger, LogicalKeyboardKey.meta)
&& !identical(trigger, LogicalKeyboardKey.metaLeft)
&& !identical(trigger, LogicalKeyboardKey.metaRight));
assert(
!identical(trigger, LogicalKeyboardKey.control) &&
!identical(trigger, LogicalKeyboardKey.controlLeft) &&
!identical(trigger, LogicalKeyboardKey.controlRight) &&
!identical(trigger, LogicalKeyboardKey.shift) &&
!identical(trigger, LogicalKeyboardKey.shiftLeft) &&
!identical(trigger, LogicalKeyboardKey.shiftRight) &&
!identical(trigger, LogicalKeyboardKey.alt) &&
!identical(trigger, LogicalKeyboardKey.altLeft) &&
!identical(trigger, LogicalKeyboardKey.altRight) &&
!identical(trigger, LogicalKeyboardKey.meta) &&
!identical(trigger, LogicalKeyboardKey.metaLeft) &&
!identical(trigger, LogicalKeyboardKey.metaRight),
);
/// The non-modifier key of the shortcut that is pressed after all modifiers
/// to activate the shortcut.

View file

@ -84,5 +84,5 @@ const List<int> kBlueRectPng = <int> [
99, 72, 140, 33, 49, 134, 196, 24, 18, 99, 72, 140, 33, 49, 134, 196, 24, 18,
99, 72, 140, 33, 49, 134, 196, 24, 18, 99, 72, 140, 33, 49, 134, 196, 24, 18,
99, 72, 140, 33, 49, 134, 196, 24, 18, 99, 72, 204, 5, 234, 78, 2, 198, 180,
170, 48, 200, 0, 0, 0, 0, 73, 69, 78, 68, 174, 66, 96, 130
170, 48, 200, 0, 0, 0, 0, 73, 69, 78, 68, 174, 66, 96, 130,
];

View file

@ -842,8 +842,10 @@ void main() {
),
));
expect(find.text('BottomSheet'), findsOneWidget);
expect(tester.getRect(find.text('BottomSheet')),
const Rect.fromLTRB(0, 586, 154, 600));
expect(
tester.getRect(find.text('BottomSheet')),
const Rect.fromLTRB(0, 586, 154, 600),
);
});
testWidgets('No constraints by default for showBottomSheet', (WidgetTester tester) async {
@ -855,7 +857,7 @@ void main() {
child: const Text('Press me'),
onPressed: () {
Scaffold.of(context).showBottomSheet<void>(
(BuildContext context) => const Text('BottomSheet')
(BuildContext context) => const Text('BottomSheet'),
);
},
),
@ -867,8 +869,10 @@ void main() {
await tester.tap(find.text('Press me'));
await tester.pumpAndSettle();
expect(find.text('BottomSheet'), findsOneWidget);
expect(tester.getRect(find.text('BottomSheet')),
const Rect.fromLTRB(0, 586, 154, 600));
expect(
tester.getRect(find.text('BottomSheet')),
const Rect.fromLTRB(0, 586, 154, 600),
);
});
testWidgets('No constraints by default for showModalBottomSheet', (WidgetTester tester) async {
@ -893,8 +897,10 @@ void main() {
await tester.tap(find.text('Press me'));
await tester.pumpAndSettle();
expect(find.text('BottomSheet'), findsOneWidget);
expect(tester.getRect(find.text('BottomSheet')),
const Rect.fromLTRB(0, 586, 800, 600));
expect(
tester.getRect(find.text('BottomSheet')),
const Rect.fromLTRB(0, 586, 800, 600),
);
});
testWidgets('Theme constraints used for bottomSheet property', (WidgetTester tester) async {
@ -902,7 +908,7 @@ void main() {
theme: ThemeData(
bottomSheetTheme: const BottomSheetThemeData(
constraints: BoxConstraints(maxWidth: 80),
)
),
),
home: const Scaffold(
body: Center(child: Text('body')),
@ -911,8 +917,10 @@ void main() {
));
expect(find.text('BottomSheet'), findsOneWidget);
// Should be centered and only 80dp wide
expect(tester.getRect(find.text('BottomSheet')),
const Rect.fromLTRB(360, 558, 440, 600));
expect(
tester.getRect(find.text('BottomSheet')),
const Rect.fromLTRB(360, 558, 440, 600),
);
});
testWidgets('Theme constraints used for showBottomSheet', (WidgetTester tester) async {
@ -920,7 +928,7 @@ void main() {
theme: ThemeData(
bottomSheetTheme: const BottomSheetThemeData(
constraints: BoxConstraints(maxWidth: 80),
)
),
),
home: Scaffold(
body: Builder(builder: (BuildContext context) {
@ -929,7 +937,7 @@ void main() {
child: const Text('Press me'),
onPressed: () {
Scaffold.of(context).showBottomSheet<void>(
(BuildContext context) => const Text('BottomSheet')
(BuildContext context) => const Text('BottomSheet'),
);
},
),
@ -942,8 +950,10 @@ void main() {
await tester.pumpAndSettle();
expect(find.text('BottomSheet'), findsOneWidget);
// Should be centered and only 80dp wide
expect(tester.getRect(find.text('BottomSheet')),
const Rect.fromLTRB(360, 558, 440, 600));
expect(
tester.getRect(find.text('BottomSheet')),
const Rect.fromLTRB(360, 558, 440, 600),
);
});
testWidgets('Theme constraints used for showModalBottomSheet', (WidgetTester tester) async {
@ -951,7 +961,7 @@ void main() {
theme: ThemeData(
bottomSheetTheme: const BottomSheetThemeData(
constraints: BoxConstraints(maxWidth: 80),
)
),
),
home: Scaffold(
body: Builder(builder: (BuildContext context) {
@ -974,8 +984,10 @@ void main() {
await tester.pumpAndSettle();
expect(find.text('BottomSheet'), findsOneWidget);
// Should be centered and only 80dp wide
expect(tester.getRect(find.text('BottomSheet')),
const Rect.fromLTRB(360, 558, 440, 600));
expect(
tester.getRect(find.text('BottomSheet')),
const Rect.fromLTRB(360, 558, 440, 600),
);
});
testWidgets('constraints param overrides theme for showBottomSheet', (WidgetTester tester) async {
@ -983,7 +995,7 @@ void main() {
theme: ThemeData(
bottomSheetTheme: const BottomSheetThemeData(
constraints: BoxConstraints(maxWidth: 80),
)
),
),
home: Scaffold(
body: Builder(builder: (BuildContext context) {
@ -1006,8 +1018,10 @@ void main() {
await tester.pumpAndSettle();
expect(find.text('BottomSheet'), findsOneWidget);
// Should be centered and only 100dp wide instead of 80dp wide
expect(tester.getRect(find.text('BottomSheet')),
const Rect.fromLTRB(350, 572, 450, 600));
expect(
tester.getRect(find.text('BottomSheet')),
const Rect.fromLTRB(350, 572, 450, 600),
);
});
testWidgets('constraints param overrides theme for showModalBottomSheet', (WidgetTester tester) async {
@ -1015,7 +1029,7 @@ void main() {
theme: ThemeData(
bottomSheetTheme: const BottomSheetThemeData(
constraints: BoxConstraints(maxWidth: 80),
)
),
),
home: Scaffold(
body: Builder(builder: (BuildContext context) {
@ -1039,8 +1053,10 @@ void main() {
await tester.pumpAndSettle();
expect(find.text('BottomSheet'), findsOneWidget);
// Should be centered and only 100dp instead of 80dp wide
expect(tester.getRect(find.text('BottomSheet')),
const Rect.fromLTRB(350, 572, 450, 600));
expect(
tester.getRect(find.text('BottomSheet')),
const Rect.fromLTRB(350, 572, 450, 600),
);
});
});

View file

@ -1744,7 +1744,7 @@ void main() {
constraints: BoxConstraints(maxWidth: 300, maxHeight: 40),
),
),
)
),
);
// Theme settings should make it 300x40 pixels
@ -1762,7 +1762,7 @@ void main() {
decoration: const InputDecoration(
constraints: BoxConstraints(maxWidth: 200, maxHeight: 32),
),
)
),
);
// InputDecoration.constraints should override the theme. It should be

View file

@ -475,7 +475,7 @@ void main() {
expect(find.byType(RefreshProgressIndicator), paints..arc(color: blue));
final Material backgroundMaterial = tester.widget(find.descendant(
of: find.byType(RefreshProgressIndicator),
matching: find.byType(Material)
matching: find.byType(Material),
));
expect(backgroundMaterial.type, MaterialType.circle);
expect(backgroundMaterial.color, green);
@ -491,8 +491,8 @@ void main() {
expect(find.byType(RefreshProgressIndicator), paintsExactlyCountTimes(#drawArc, 1));
expect(find.byType(RefreshProgressIndicator), paints..arc(color: green));
final Material themeBackgroundMaterial = tester.widget(find.descendant(
of: find.byType(RefreshProgressIndicator),
matching: find.byType(Material)
of: find.byType(RefreshProgressIndicator),
matching: find.byType(Material),
));
expect(themeBackgroundMaterial.type, MaterialType.circle);
expect(themeBackgroundMaterial.color, blue);