@@ -31,7 +31,8 @@ class MaterialDesktopControls extends StatefulWidget {
31
31
}
32
32
}
33
33
34
- class _MaterialDesktopControlsState extends State <MaterialDesktopControls > with SingleTickerProviderStateMixin {
34
+ class _MaterialDesktopControlsState extends State <MaterialDesktopControls >
35
+ with SingleTickerProviderStateMixin {
35
36
late PlayerNotifier notifier;
36
37
late VideoPlayerValue _latestValue;
37
38
double ? _latestVolume;
@@ -66,11 +67,14 @@ class _MaterialDesktopControlsState extends State<MaterialDesktopControls> with
66
67
void _handleKeyPress (event) {
67
68
if (event is KeyDownEvent && event.logicalKey == LogicalKeyboardKey .space) {
68
69
_playPause ();
69
- } else if (event is KeyDownEvent && event.logicalKey == LogicalKeyboardKey .arrowRight) {
70
+ } else if (event is KeyDownEvent &&
71
+ event.logicalKey == LogicalKeyboardKey .arrowRight) {
70
72
_seekForward ();
71
- } else if (event is KeyDownEvent && event.logicalKey == LogicalKeyboardKey .arrowLeft) {
73
+ } else if (event is KeyDownEvent &&
74
+ event.logicalKey == LogicalKeyboardKey .arrowLeft) {
72
75
_seekBackward ();
73
- } else if (event is KeyDownEvent && event.logicalKey == LogicalKeyboardKey .escape) {
76
+ } else if (event is KeyDownEvent &&
77
+ event.logicalKey == LogicalKeyboardKey .escape) {
74
78
if (chewieController.isFullScreen) {
75
79
_onExpandCollapse ();
76
80
}
@@ -123,7 +127,8 @@ class _MaterialDesktopControlsState extends State<MaterialDesktopControls> with
123
127
0.0 ,
124
128
notifier.hideStuff ? barHeight * 0.8 : 0.0 ,
125
129
),
126
- child: _buildSubtitles (context, chewieController.subtitle! ),
130
+ child: _buildSubtitles (
131
+ context, chewieController.subtitle! ),
127
132
),
128
133
_buildBottomBar (context),
129
134
],
@@ -183,11 +188,13 @@ class _MaterialDesktopControlsState extends State<MaterialDesktopControls> with
183
188
_onSpeedButtonTap ();
184
189
},
185
190
iconData: Icons .speed,
186
- title: chewieController.optionsTranslation? .playbackSpeedButtonText ?? 'Playback speed' ,
191
+ title: chewieController.optionsTranslation? .playbackSpeedButtonText ??
192
+ 'Playback speed' ,
187
193
)
188
194
];
189
195
190
- if (chewieController.additionalOptions != null && chewieController.additionalOptions !(context).isNotEmpty) {
196
+ if (chewieController.additionalOptions != null &&
197
+ chewieController.additionalOptions !(context).isNotEmpty) {
191
198
options.addAll (chewieController.additionalOptions !(context));
192
199
}
193
200
@@ -208,7 +215,8 @@ class _MaterialDesktopControlsState extends State<MaterialDesktopControls> with
208
215
useRootNavigator: chewieController.useRootNavigator,
209
216
builder: (context) => OptionsDialog (
210
217
options: options,
211
- cancelButtonText: chewieController.optionsTranslation? .cancelButtonText,
218
+ cancelButtonText:
219
+ chewieController.optionsTranslation? .cancelButtonText,
212
220
),
213
221
);
214
222
}
@@ -270,7 +278,8 @@ class _MaterialDesktopControlsState extends State<MaterialDesktopControls> with
270
278
duration: const Duration (milliseconds: 300 ),
271
279
child: Container (
272
280
height: barHeight + (chewieController.isFullScreen ? 20.0 : 0 ),
273
- padding: EdgeInsets .only (bottom: chewieController.isFullScreen ? 10.0 : 15 ),
281
+ padding:
282
+ EdgeInsets .only (bottom: chewieController.isFullScreen ? 10.0 : 15 ),
274
283
child: SafeArea (
275
284
bottom: chewieController.isFullScreen,
276
285
child: Column (
@@ -282,12 +291,19 @@ class _MaterialDesktopControlsState extends State<MaterialDesktopControls> with
282
291
child: Row (
283
292
children: < Widget > [
284
293
_buildPlayPause (controller),
285
- if (chewieController.allowMuting) _buildMuteButton (controller),
286
- if (chewieController.isLive) const Expanded (child: Text ('LIVE' )) else _buildPosition (iconColor),
294
+ if (chewieController.allowMuting)
295
+ _buildMuteButton (controller),
296
+ if (chewieController.isLive)
297
+ const Expanded (child: Text ('LIVE' ))
298
+ else
299
+ _buildPosition (iconColor),
287
300
const Spacer (),
288
- if (chewieController.showControls && chewieController.subtitle != null && chewieController.subtitle! .isNotEmpty)
301
+ if (chewieController.showControls &&
302
+ chewieController.subtitle != null &&
303
+ chewieController.subtitle! .isNotEmpty)
289
304
_buildSubtitleToggle (icon: Icons .subtitles),
290
- if (chewieController.showOptions) _buildOptionsButton (icon: Icons .settings),
305
+ if (chewieController.showOptions)
306
+ _buildOptionsButton (icon: Icons .settings),
291
307
if (chewieController.allowFullScreen) _buildExpandButton (),
292
308
],
293
309
),
@@ -329,7 +345,9 @@ class _MaterialDesktopControlsState extends State<MaterialDesktopControls> with
329
345
),
330
346
child: Center (
331
347
child: Icon (
332
- chewieController.isFullScreen ? Icons .fullscreen_exit : Icons .fullscreen,
348
+ chewieController.isFullScreen
349
+ ? Icons .fullscreen_exit
350
+ : Icons .fullscreen,
333
351
color: Colors .white,
334
352
),
335
353
),
@@ -339,8 +357,10 @@ class _MaterialDesktopControlsState extends State<MaterialDesktopControls> with
339
357
}
340
358
341
359
Widget _buildHitArea () {
342
- final bool isFinished = _latestValue.position >= _latestValue.duration && _latestValue.duration.inSeconds > 0 ;
343
- final bool showPlayButton = widget.showPlayButton && ! _dragging && ! notifier.hideStuff;
360
+ final bool isFinished = _latestValue.position >= _latestValue.duration &&
361
+ _latestValue.duration.inSeconds > 0 ;
362
+ final bool showPlayButton =
363
+ widget.showPlayButton && ! _dragging && ! notifier.hideStuff;
344
364
345
365
return GestureDetector (
346
366
onTap: () {
@@ -475,7 +495,8 @@ class _MaterialDesktopControlsState extends State<MaterialDesktopControls> with
475
495
}
476
496
477
497
Future <void > _initialize () async {
478
- _subtitleOn = chewieController.showSubtitles && (chewieController.subtitle? .isNotEmpty ?? false );
498
+ _subtitleOn = chewieController.showSubtitles &&
499
+ (chewieController.subtitle? .isNotEmpty ?? false );
479
500
controller.addListener (_updateState);
480
501
481
502
_updateState ();
@@ -500,7 +521,8 @@ class _MaterialDesktopControlsState extends State<MaterialDesktopControls> with
500
521
501
522
chewieController.toggleFullScreen ();
502
523
503
- _showAfterExpandCollapseTimer = Timer (const Duration (milliseconds: 300 ), () {
524
+ _showAfterExpandCollapseTimer =
525
+ Timer (const Duration (milliseconds: 300 ), () {
504
526
setState (() {
505
527
_cancelAndRestartTimer ();
506
528
});
@@ -531,8 +553,9 @@ class _MaterialDesktopControlsState extends State<MaterialDesktopControls> with
531
553
}
532
554
533
555
void _startHideTimer () {
534
- final hideControlsTimer =
535
- chewieController.hideControlsTimer.isNegative ? ChewieController .defaultHideControlsTimer : chewieController.hideControlsTimer;
556
+ final hideControlsTimer = chewieController.hideControlsTimer.isNegative
557
+ ? ChewieController .defaultHideControlsTimer
558
+ : chewieController.hideControlsTimer;
536
559
_hideTimer = Timer (hideControlsTimer, () {
537
560
setState (() {
538
561
notifier.hideStuff = true ;
@@ -627,8 +650,10 @@ class _MaterialDesktopControlsState extends State<MaterialDesktopControls> with
627
650
ChewieProgressColors (
628
651
playedColor: Theme .of (context).colorScheme.secondary,
629
652
handleColor: Theme .of (context).colorScheme.secondary,
630
- bufferedColor: Theme .of (context).colorScheme.surface.withOpacityCompat (0.5 ),
631
- backgroundColor: Theme .of (context).disabledColor.withOpacityCompat (0.5 ),
653
+ bufferedColor:
654
+ Theme .of (context).colorScheme.surface.withOpacityCompat (0.5 ),
655
+ backgroundColor:
656
+ Theme .of (context).disabledColor.withOpacityCompat (0.5 ),
632
657
),
633
658
draggableProgressBar: chewieController.draggableProgressBar,
634
659
),
0 commit comments