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