refactor: simplify mobile player controls

close #641
This commit is contained in:
edde746
2026-03-07 20:48:17 +01:00
parent 5b910fd3d7
commit 0b1f64ef8a
3 changed files with 3 additions and 30 deletions
+2 -2
View File
@@ -13,7 +13,7 @@ IconData getReplayIcon(int seconds) {
case 30:
return Symbols.replay_30_rounded;
default:
return Symbols.replay_rounded; // Generic icon for custom durations
return Symbols.replay_rounded;
}
}
@@ -29,6 +29,6 @@ IconData getForwardIcon(int seconds) {
case 30:
return Symbols.forward_30_rounded;
default:
return Symbols.forward_rounded; // Generic icon for custom durations
return Symbols.forward_media_rounded;
}
}
@@ -41,9 +41,6 @@ class MobileVideoControls extends StatefulWidget {
final VoidCallback? onBack;
final VoidCallback? onNext;
final VoidCallback? onPrevious;
final VoidCallback? onSeekToPreviousChapter;
final VoidCallback? onSeekToNextChapter;
/// Whether the user can control playback (false in host-only mode for non-host).
final bool canControl;
@@ -91,8 +88,6 @@ class MobileVideoControls extends StatefulWidget {
this.onBack,
this.onNext,
this.onPrevious,
this.onSeekToPreviousChapter,
this.onSeekToNextChapter,
this.canControl = true,
this.hasFirstFrame,
this.thumbnailDataBuilder,
@@ -307,8 +302,6 @@ class _MobileVideoControlsState extends State<MobileVideoControls>
}
Widget _buildPlaybackControlsContent(BuildContext _) {
final hasChapters = !widget.isLive && widget.chaptersLoaded && widget.chapters.isNotEmpty;
return PlayPauseStreamBuilder(
player: widget.player,
builder: (context, isPlaying) {
@@ -316,15 +309,6 @@ class _MobileVideoControlsState extends State<MobileVideoControls>
mainAxisAlignment: MainAxisAlignment.center,
children: [
if (!widget.isLive) ...[
if (hasChapters) ...[
CircularControlButton(
semanticLabel: t.videoControls.previousChapterButton,
icon: Symbols.fast_rewind_rounded,
iconSize: 32,
onPressed: widget.onSeekToPreviousChapter,
),
const SizedBox(width: 16),
],
// Previous episode button (greyed out when unavailable)
CircularControlButton(
semanticLabel: t.videoControls.previousButton,
@@ -357,15 +341,6 @@ class _MobileVideoControlsState extends State<MobileVideoControls>
iconSize: 48,
onPressed: widget.onNext,
),
if (hasChapters) ...[
const SizedBox(width: 16),
CircularControlButton(
semanticLabel: t.videoControls.nextChapterButton,
icon: Symbols.fast_forward_rounded,
iconSize: 32,
onPressed: widget.onSeekToNextChapter,
),
],
],
],
);
@@ -1384,7 +1384,7 @@ class _PlexVideoControlsState extends State<PlexVideoControls> with WindowListen
mainAxisSize: MainAxisSize.min,
children: [
AppIcon(
_lastDoubleTapWasForward ? Symbols.fast_forward_rounded : Symbols.fast_rewind_rounded,
_lastDoubleTapWasForward ? Symbols.forward_media_rounded : Symbols.replay_rounded,
fill: 1,
color: Colors.white,
size: 32,
@@ -1978,8 +1978,6 @@ class _PlexVideoControlsState extends State<PlexVideoControls> with WindowListen
onBack: widget.onBack,
onNext: widget.onNext,
onPrevious: widget.onPrevious,
onSeekToPreviousChapter: _seekToPreviousChapter,
onSeekToNextChapter: _seekToNextChapter,
canControl: widget.canControl,
hasFirstFrame: widget.hasFirstFrame,
thumbnailDataBuilder: widget.thumbnailDataBuilder,