Skip to content

Commit e71eb18

Browse files
authored
Use curly_braces_in_flow_control_structures for rendering (#104611)
* Use `curly_braces_in_flow_control_structures` for `rendering` * fix comments * fix dangling
1 parent b0aa502 commit e71eb18

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1890
-955
lines changed

packages/flutter/lib/src/rendering/animated_size.dart

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,9 @@ class RenderAnimatedSize extends RenderAligningShiftedBox {
9494
duration: duration,
9595
reverseDuration: reverseDuration,
9696
)..addListener(() {
97-
if (_controller.value != _lastValue)
97+
if (_controller.value != _lastValue) {
9898
markNeedsLayout();
99+
}
99100
});
100101
_animation = CurvedAnimation(
101102
parent: _controller,
@@ -120,25 +121,28 @@ class RenderAnimatedSize extends RenderAligningShiftedBox {
120121
Duration get duration => _controller.duration!;
121122
set duration(Duration value) {
122123
assert(value != null);
123-
if (value == _controller.duration)
124+
if (value == _controller.duration) {
124125
return;
126+
}
125127
_controller.duration = value;
126128
}
127129

128130
/// The duration of the animation when running in reverse.
129131
Duration? get reverseDuration => _controller.reverseDuration;
130132
set reverseDuration(Duration? value) {
131-
if (value == _controller.reverseDuration)
133+
if (value == _controller.reverseDuration) {
132134
return;
135+
}
133136
_controller.reverseDuration = value;
134137
}
135138

136139
/// The curve of the animation.
137140
Curve get curve => _animation.curve;
138141
set curve(Curve value) {
139142
assert(value != null);
140-
if (value == _animation.curve)
143+
if (value == _animation.curve) {
141144
return;
145+
}
142146
_animation.curve = value;
143147
}
144148

@@ -167,8 +171,9 @@ class RenderAnimatedSize extends RenderAligningShiftedBox {
167171
TickerProvider _vsync;
168172
set vsync(TickerProvider value) {
169173
assert(value != null);
170-
if (value == _vsync)
174+
if (value == _vsync) {
171175
return;
176+
}
172177
_vsync = value;
173178
_controller.resync(vsync);
174179
}
@@ -234,8 +239,9 @@ class RenderAnimatedSize extends RenderAligningShiftedBox {
234239
alignChild();
235240

236241
if (size.width < _sizeTween.end!.width ||
237-
size.height < _sizeTween.end!.height)
242+
size.height < _sizeTween.end!.height) {
238243
_hasVisualOverflow = true;
244+
}
239245
}
240246

241247
@override
@@ -318,8 +324,10 @@ class RenderAnimatedSize extends RenderAligningShiftedBox {
318324
} else {
319325
// Child size stabilized.
320326
_state = RenderAnimatedSizeState.stable;
321-
if (!_controller.isAnimating)
322-
_controller.forward(); // resume the animation after being detached
327+
if (!_controller.isAnimating) {
328+
// Resume the animation after being detached.
329+
_controller.forward();
330+
}
323331
}
324332
}
325333

packages/flutter/lib/src/rendering/binding.dart

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,9 @@ mixin RendererBinding on BindingBase, ServicesBinding, SchedulerBinding, Gesture
7777
name: 'debugPaint',
7878
getter: () async => debugPaintSizeEnabled,
7979
setter: (bool value) {
80-
if (debugPaintSizeEnabled == value)
80+
if (debugPaintSizeEnabled == value) {
8181
return Future<void>.value();
82+
}
8283
debugPaintSizeEnabled = value;
8384
return _forceRepaint();
8485
},
@@ -87,8 +88,9 @@ mixin RendererBinding on BindingBase, ServicesBinding, SchedulerBinding, Gesture
8788
name: 'debugPaintBaselinesEnabled',
8889
getter: () async => debugPaintBaselinesEnabled,
8990
setter: (bool value) {
90-
if (debugPaintBaselinesEnabled == value)
91+
if (debugPaintBaselinesEnabled == value) {
9192
return Future<void>.value();
93+
}
9294
debugPaintBaselinesEnabled = value;
9395
return _forceRepaint();
9496
},
@@ -99,8 +101,9 @@ mixin RendererBinding on BindingBase, ServicesBinding, SchedulerBinding, Gesture
99101
setter: (bool value) {
100102
final bool repaint = debugRepaintRainbowEnabled && !value;
101103
debugRepaintRainbowEnabled = value;
102-
if (repaint)
104+
if (repaint) {
103105
return _forceRepaint();
106+
}
104107
return Future<void>.value();
105108
},
106109
);
@@ -117,8 +120,9 @@ mixin RendererBinding on BindingBase, ServicesBinding, SchedulerBinding, Gesture
117120
name: 'debugDisableClipLayers',
118121
getter: () async => debugDisableClipLayers,
119122
setter: (bool value) {
120-
if (debugDisableClipLayers == value)
123+
if (debugDisableClipLayers == value) {
121124
return Future<void>.value();
125+
}
122126
debugDisableClipLayers = value;
123127
return _forceRepaint();
124128
},
@@ -127,8 +131,9 @@ mixin RendererBinding on BindingBase, ServicesBinding, SchedulerBinding, Gesture
127131
name: 'debugDisablePhysicalShapeLayers',
128132
getter: () async => debugDisablePhysicalShapeLayers,
129133
setter: (bool value) {
130-
if (debugDisablePhysicalShapeLayers == value)
134+
if (debugDisablePhysicalShapeLayers == value) {
131135
return Future<void>.value();
136+
}
132137
debugDisablePhysicalShapeLayers = value;
133138
return _forceRepaint();
134139
},
@@ -137,8 +142,9 @@ mixin RendererBinding on BindingBase, ServicesBinding, SchedulerBinding, Gesture
137142
name: 'debugDisableOpacityLayers',
138143
getter: () async => debugDisableOpacityLayers,
139144
setter: (bool value) {
140-
if (debugDisableOpacityLayers == value)
145+
if (debugDisableOpacityLayers == value) {
141146
return Future<void>.value();
147+
}
142148
debugDisableOpacityLayers = value;
143149
return _forceRepaint();
144150
},
@@ -181,16 +187,18 @@ mixin RendererBinding on BindingBase, ServicesBinding, SchedulerBinding, Gesture
181187
name: 'profileRenderObjectPaints',
182188
getter: () async => debugProfilePaintsEnabled,
183189
setter: (bool value) async {
184-
if (debugProfilePaintsEnabled != value)
190+
if (debugProfilePaintsEnabled != value) {
185191
debugProfilePaintsEnabled = value;
192+
}
186193
},
187194
);
188195
registerBoolServiceExtension(
189196
name: 'profileRenderObjectLayouts',
190197
getter: () async => debugProfileLayoutsEnabled,
191198
setter: (bool value) async {
192-
if (debugProfileLayoutsEnabled != value)
199+
if (debugProfileLayoutsEnabled != value) {
193200
debugProfileLayoutsEnabled = value;
201+
}
194202
},
195203
);
196204
}
@@ -431,8 +439,9 @@ mixin RendererBinding on BindingBase, ServicesBinding, SchedulerBinding, Gesture
431439
// Always schedule a warm up frame even if the deferral count is not down to
432440
// zero yet since the removal of a deferral may uncover new deferrals that
433441
// are lower in the widget tree.
434-
if (!_firstFrameSent)
442+
if (!_firstFrameSent) {
435443
scheduleWarmUpFrame();
444+
}
436445
}
437446

438447
/// Call this to pretend that no frames have been sent to the engine yet.
@@ -610,8 +619,9 @@ class RenderingFlutterBinding extends BindingBase with GestureBinding, Scheduler
610619
/// if you are using it directly. If you are using the widgets framework,
611620
/// see [WidgetsFlutterBinding.ensureInitialized].
612621
static RendererBinding ensureInitialized() {
613-
if (RendererBinding._instance == null)
622+
if (RendererBinding._instance == null) {
614623
RenderingFlutterBinding();
624+
}
615625
return RendererBinding.instance;
616626
}
617627
}

0 commit comments

Comments
 (0)