Skip to content

Commit b7b9f9b

Browse files
committed
lint: Format to line length = 80 for pub score
1 parent 178274a commit b7b9f9b

10 files changed

+118
-52
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99

1010
jobs:
1111
check-format:
12-
name: Check format using flutter format -l 120
12+
name: Check format using flutter format .
1313
runs-on: ubuntu-latest
1414

1515
steps:
@@ -19,7 +19,7 @@ jobs:
1919
with:
2020
channel: beta
2121
- name: Check format
22-
run: flutter format -l 120 -n . --set-exit-if-changed
22+
run: flutter format -n . --set-exit-if-changed
2323

2424
lint:
2525
name: Lint

example/lib/auto_rotate.dart

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ class _ChewieDemoState extends State<ChewieDemo> {
4646
videoPlayerController: _videoPlayerController1,
4747
autoPlay: true,
4848
looping: true,
49-
routePageBuilder:
50-
(BuildContext context, Animation<double> animation, Animation<double> secondAnimation, provider) {
49+
routePageBuilder: (BuildContext context, Animation<double> animation,
50+
Animation<double> secondAnimation, provider) {
5151
return AnimatedBuilder(
5252
animation: animation,
5353
builder: (BuildContext context, Widget child) {
@@ -104,7 +104,9 @@ class _ChewieDemoState extends State<ChewieDemo> {
104104
children: <Widget>[
105105
Expanded(
106106
child: Center(
107-
child: _chewieController != null && _chewieController.videoPlayerController.value.initialized
107+
child: _chewieController != null &&
108+
_chewieController
109+
.videoPlayerController.value.initialized
108110
? Chewie(
109111
controller: _chewieController,
110112
)

example/lib/main.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,9 @@ class _ChewieDemoState extends State<ChewieDemo> {
8484
children: <Widget>[
8585
Expanded(
8686
child: Center(
87-
child: _chewieController != null && _chewieController.videoPlayerController.value.initialized
87+
child: _chewieController != null &&
88+
_chewieController
89+
.videoPlayerController.value.initialized
8890
? Chewie(
8991
controller: _chewieController,
9092
)

lib/src/chewie_player.dart

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,11 @@ class ChewieState extends State<Chewie> {
116116
);
117117

118118
if (widget.controller.routePageBuilder == null) {
119-
return _defaultRoutePageBuilder(context, animation, secondaryAnimation, controllerProvider);
119+
return _defaultRoutePageBuilder(
120+
context, animation, secondaryAnimation, controllerProvider);
120121
}
121-
return widget.controller.routePageBuilder(context, animation, secondaryAnimation, controllerProvider);
122+
return widget.controller.routePageBuilder(
123+
context, animation, secondaryAnimation, controllerProvider);
122124
}
123125

124126
Future<dynamic> _pushFullScreenWidget(BuildContext context) async {
@@ -140,25 +142,30 @@ class ChewieState extends State<Chewie> {
140142
// so we do not need to check Wakelock.isEnabled.
141143
Wakelock.disable();
142144

143-
SystemChrome.setEnabledSystemUIOverlays(widget.controller.systemOverlaysAfterFullScreen);
144-
SystemChrome.setPreferredOrientations(widget.controller.deviceOrientationsAfterFullScreen);
145+
SystemChrome.setEnabledSystemUIOverlays(
146+
widget.controller.systemOverlaysAfterFullScreen);
147+
SystemChrome.setPreferredOrientations(
148+
widget.controller.deviceOrientationsAfterFullScreen);
145149
}
146150

147151
void onEnterFullScreen() {
148152
final videoWidth = widget.controller.videoPlayerController.value.size.width;
149-
final videoHeight = widget.controller.videoPlayerController.value.size.height;
153+
final videoHeight =
154+
widget.controller.videoPlayerController.value.size.height;
150155

151156
if (widget.controller.systemOverlaysOnEnterFullScreen != null) {
152157
/// Optional user preferred settings
153-
SystemChrome.setEnabledSystemUIOverlays(widget.controller.systemOverlaysOnEnterFullScreen);
158+
SystemChrome.setEnabledSystemUIOverlays(
159+
widget.controller.systemOverlaysOnEnterFullScreen);
154160
} else {
155161
/// Default behavior
156162
SystemChrome.setEnabledSystemUIOverlays([]);
157163
}
158164

159165
if (widget.controller.deviceOrientationsOnEnterFullScreen != null) {
160166
/// Optional user preferred settings
161-
SystemChrome.setPreferredOrientations(widget.controller.deviceOrientationsOnEnterFullScreen);
167+
SystemChrome.setPreferredOrientations(
168+
widget.controller.deviceOrientationsOnEnterFullScreen);
162169
} else {
163170
final isLandscapeVideo = videoWidth > videoHeight;
164171
final isPortraitVideo = videoWidth < videoHeight;
@@ -226,8 +233,10 @@ class ChewieController extends ChangeNotifier {
226233
this.systemOverlaysAfterFullScreen = SystemUiOverlay.values,
227234
this.deviceOrientationsAfterFullScreen = DeviceOrientation.values,
228235
this.routePageBuilder,
229-
}) : assert(videoPlayerController != null, 'You must provide a controller to play a video'),
230-
assert(playbackSpeeds.every((speed) => speed > 0), 'The playbackSpeeds values must all be greater than 0') {
236+
}) : assert(videoPlayerController != null,
237+
'You must provide a controller to play a video'),
238+
assert(playbackSpeeds.every((speed) => speed > 0),
239+
'The playbackSpeeds values must all be greater than 0') {
231240
_initialize();
232241
}
233242

@@ -318,7 +327,8 @@ class ChewieController extends ChangeNotifier {
318327
final ChewieRoutePageBuilder routePageBuilder;
319328

320329
static ChewieController of(BuildContext context) {
321-
final chewieControllerProvider = context.dependOnInheritedWidgetOfExactType<_ChewieControllerProvider>();
330+
final chewieControllerProvider =
331+
context.dependOnInheritedWidgetOfExactType<_ChewieControllerProvider>();
322332

323333
return chewieControllerProvider.controller;
324334
}
@@ -332,7 +342,8 @@ class ChewieController extends ChangeNotifier {
332342
Future _initialize() async {
333343
await videoPlayerController.setLooping(looping);
334344

335-
if ((autoInitialize || autoPlay) && !videoPlayerController.value.initialized) {
345+
if ((autoInitialize || autoPlay) &&
346+
!videoPlayerController.value.initialized) {
336347
await videoPlayerController.initialize();
337348
}
338349

@@ -413,5 +424,6 @@ class _ChewieControllerProvider extends InheritedWidget {
413424
final ChewieController controller;
414425

415426
@override
416-
bool updateShouldNotify(_ChewieControllerProvider old) => controller != old.controller;
427+
bool updateShouldNotify(_ChewieControllerProvider old) =>
428+
controller != old.controller;
417429
}

lib/src/cupertino_controls.dart

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ class CupertinoControls extends StatefulWidget {
2727
}
2828
}
2929

30-
class _CupertinoControlsState extends State<CupertinoControls> with SingleTickerProviderStateMixin {
30+
class _CupertinoControlsState extends State<CupertinoControls>
31+
with SingleTickerProviderStateMixin {
3132
VideoPlayerValue _latestValue;
3233
double _latestVolume;
3334
bool _hideStuff = true;
@@ -80,7 +81,8 @@ class _CupertinoControlsState extends State<CupertinoControls> with SingleTicker
8081
absorbing: _hideStuff,
8182
child: Column(
8283
children: <Widget>[
83-
_buildTopBar(backgroundColor, iconColor, barHeight, buttonPadding),
84+
_buildTopBar(
85+
backgroundColor, iconColor, barHeight, buttonPadding),
8486
_buildHitArea(),
8587
_buildBottomBar(backgroundColor, iconColor, barHeight),
8688
],
@@ -221,7 +223,8 @@ class _CupertinoControlsState extends State<CupertinoControls> with SingleTicker
221223
}
222224

223225
Expanded _buildHitArea() {
224-
final bool isFinished = _latestValue.duration != null && _latestValue.position >= _latestValue.duration;
226+
final bool isFinished = _latestValue.duration != null &&
227+
_latestValue.position >= _latestValue.duration;
225228

226229
return Expanded(
227230
child: GestureDetector(
@@ -238,7 +241,10 @@ class _CupertinoControlsState extends State<CupertinoControls> with SingleTicker
238241
color: Colors.transparent,
239242
child: Center(
240243
child: AnimatedOpacity(
241-
opacity: _latestValue != null && !_latestValue.isPlaying && !_dragging ? 1.0 : 0.0,
244+
opacity:
245+
_latestValue != null && !_latestValue.isPlaying && !_dragging
246+
? 1.0
247+
: 0.0,
242248
duration: const Duration(milliseconds: 300),
243249
child: GestureDetector(
244250
child: Container(
@@ -250,7 +256,8 @@ class _CupertinoControlsState extends State<CupertinoControls> with SingleTicker
250256
padding: const EdgeInsets.all(12.0),
251257
child: IconButton(
252258
icon: isFinished
253-
? Icon(Icons.replay, size: 32.0, color: widget.iconColor)
259+
? Icon(Icons.replay,
260+
size: 32.0, color: widget.iconColor)
254261
: AnimatedIcon(
255262
icon: AnimatedIcons.play_pause,
256263
progress: playPauseIconAnimationController,
@@ -303,7 +310,9 @@ class _CupertinoControlsState extends State<CupertinoControls> with SingleTicker
303310
right: buttonPadding,
304311
),
305312
child: Icon(
306-
(_latestValue != null && _latestValue.volume > 0) ? Icons.volume_up : Icons.volume_off,
313+
(_latestValue != null && _latestValue.volume > 0)
314+
? Icons.volume_up
315+
: Icons.volume_off,
307316
color: iconColor,
308317
size: 16,
309318
),
@@ -338,7 +347,8 @@ class _CupertinoControlsState extends State<CupertinoControls> with SingleTicker
338347
}
339348

340349
Widget _buildPosition(Color iconColor) {
341-
final position = _latestValue != null ? _latestValue.position : const Duration();
350+
final position =
351+
_latestValue != null ? _latestValue.position : const Duration();
342352

343353
return Padding(
344354
padding: const EdgeInsets.only(right: 12.0),
@@ -476,10 +486,12 @@ class _CupertinoControlsState extends State<CupertinoControls> with SingleTicker
476486
child: Row(
477487
children: <Widget>[
478488
if (chewieController.allowFullScreen)
479-
_buildExpandButton(backgroundColor, iconColor, barHeight, buttonPadding),
489+
_buildExpandButton(
490+
backgroundColor, iconColor, barHeight, buttonPadding),
480491
const Spacer(),
481492
if (chewieController.allowMuting)
482-
_buildMuteButton(controller, backgroundColor, iconColor, barHeight, buttonPadding),
493+
_buildMuteButton(controller, backgroundColor, iconColor, barHeight,
494+
buttonPadding),
483495
],
484496
),
485497
);
@@ -500,7 +512,8 @@ class _CupertinoControlsState extends State<CupertinoControls> with SingleTicker
500512

501513
_updateState();
502514

503-
if ((controller.value != null && controller.value.isPlaying) || chewieController.autoPlay) {
515+
if ((controller.value != null && controller.value.isPlaying) ||
516+
chewieController.autoPlay) {
504517
_startHideTimer();
505518
}
506519

@@ -611,14 +624,16 @@ class _CupertinoControlsState extends State<CupertinoControls> with SingleTicker
611624
void _skipBack() {
612625
_cancelAndRestartTimer();
613626
final beginning = const Duration().inMilliseconds;
614-
final skip = (_latestValue.position - const Duration(seconds: 15)).inMilliseconds;
627+
final skip =
628+
(_latestValue.position - const Duration(seconds: 15)).inMilliseconds;
615629
controller.seekTo(Duration(milliseconds: math.max(skip, beginning)));
616630
}
617631

618632
void _skipForward() {
619633
_cancelAndRestartTimer();
620634
final end = _latestValue.duration.inMilliseconds;
621-
final skip = (_latestValue.position + const Duration(seconds: 15)).inMilliseconds;
635+
final skip =
636+
(_latestValue.position + const Duration(seconds: 15)).inMilliseconds;
622637
controller.seekTo(Duration(milliseconds: math.min(skip, end)));
623638
}
624639

@@ -664,7 +679,8 @@ class _PlaybackSpeedDialog extends StatelessWidget {
664679
child: Row(
665680
mainAxisAlignment: MainAxisAlignment.center,
666681
children: [
667-
if (e == _selected) Icon(Icons.check, size: 20.0, color: selectedColor),
682+
if (e == _selected)
683+
Icon(Icons.check, size: 20.0, color: selectedColor),
668684
Text(e.toString()),
669685
],
670686
),

lib/src/cupertino_progress_bar.dart

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,10 @@ class _ProgressBarPainter extends CustomPainter {
127127
if (!value.initialized) {
128128
return;
129129
}
130-
final double playedPartPercent = value.position.inMilliseconds / value.duration.inMilliseconds;
131-
final double playedPart = playedPartPercent > 1 ? size.width : playedPartPercent * size.width;
130+
final double playedPartPercent =
131+
value.position.inMilliseconds / value.duration.inMilliseconds;
132+
final double playedPart =
133+
playedPartPercent > 1 ? size.width : playedPartPercent * size.width;
132134
for (final DurationRange range in value.buffered) {
133135
final double start = range.startFraction(value.duration) * size.width;
134136
final double end = range.endFraction(value.duration) * size.width;
@@ -155,7 +157,9 @@ class _ProgressBarPainter extends CustomPainter {
155157
);
156158

157159
final shadowPath = Path()
158-
..addOval(Rect.fromCircle(center: Offset(playedPart, baseOffset + barHeight / 2), radius: handleHeight));
160+
..addOval(Rect.fromCircle(
161+
center: Offset(playedPart, baseOffset + barHeight / 2),
162+
radius: handleHeight));
159163

160164
canvas.drawShadow(shadowPath, Colors.black, 0.2, false);
161165
canvas.drawCircle(

0 commit comments

Comments
 (0)