Skip to content

Commit

Permalink
fix: monochrome controls for fullscreen radio TV video streams (#1009)
Browse files Browse the repository at this point in the history
  • Loading branch information
Feichtmeier authored Nov 13, 2024
1 parent a9e8acb commit 9effd9c
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 19 deletions.
9 changes: 6 additions & 3 deletions lib/player/view/full_height_player_top_controls.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,19 @@ class FullHeightPlayerTopControls extends StatelessWidget with WatchItMixin {
),
icon: Icon(
Iconz.imageMissingFilled,
color: context.theme.colorScheme.onSurface,
color: iconColor,
),
),
if (audio?.audioType != AudioType.podcast)
switch (audio?.audioType) {
AudioType.local => LikeIcon(
audio: audio,
color: context.theme.colorScheme.onSurface,
color: iconColor,
),
AudioType.radio => RadioLikeIcon(
audio: audio,
color: iconColor,
),
AudioType.radio => RadioLikeIcon(audio: audio),
_ => const SizedBox.shrink(),
},
if (showQueueButton) QueueButton(color: iconColor),
Expand Down
8 changes: 6 additions & 2 deletions lib/player/view/full_height_video_player.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:watch_it/watch_it.dart';
import 'package:yaru/constants.dart';

import '../../app/connectivity_model.dart';
import '../../common/data/audio.dart';
import '../../common/view/icons.dart';
import '../../l10n/l10n.dart';
import '../player_model.dart';
Expand All @@ -30,15 +31,18 @@ class FullHeightVideoPlayer extends StatelessWidget with WatchItMixin {
padding: EdgeInsets.zero,
);

final text =
'${audio?.title == null ? '' : '${audio!.title}'} - ${audio?.album == null ? '' : '${audio!.album}'} - ${audio?.artist == null ? '' : '${audio!.artist}'}';
final text = audio?.audioType == AudioType.radio
? audio?.title ?? ''
: '${audio?.title == null ? '' : '${audio!.title}'} - ${audio?.album == null ? '' : '${audio!.album}'} - ${audio?.artist == null ? '' : '${audio!.artist}'}';
final mediaKitTheme = MaterialVideoControlsThemeData(
seekBarThumbColor: baseColor,
seekBarColor: baseColor.withOpacity(0.3),
seekBarPositionColor: baseColor.withOpacity(0.9),
seekBarBufferColor: baseColor.withOpacity(0.6),
buttonBarButtonColor: baseColor,
controlsHoverDuration: const Duration(seconds: 10),
seekGesture: true,
seekOnDoubleTap: true,
primaryButtonBar: [
SizedBox(
width: 300,
Expand Down
42 changes: 30 additions & 12 deletions lib/player/view/player_main_controls.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,16 @@ class PlayerMainControls extends StatelessWidget with WatchItMixin {
required this.active,
this.iconColor,
this.avatarColor,
this.mainAxisAlignment = MainAxisAlignment.center,
this.mainAxisSize = MainAxisSize.max,
this.avatarPlayButton = true,
});

final bool active;
final Color? iconColor, avatarColor;
final MainAxisAlignment mainAxisAlignment;
final MainAxisSize mainAxisSize;
final bool avatarPlayButton;

@override
Widget build(BuildContext context) {
Expand All @@ -37,6 +43,23 @@ class PlayerMainControls extends StatelessWidget with WatchItMixin {
final isOnline = watchPropertyValue((ConnectivityModel m) => m.isOnline);
final active = audio?.path != null || isOnline;

final rawPlayButton = PlayButton(
iconColor: iconColor ?? (theme.isLight ? Colors.white : Colors.black),
active: active,
);

final playButton = avatarPlayButton
? CircleAvatar(
radius: avatarIconRadius,
backgroundColor:
avatarColor ?? (theme.isLight ? Colors.black : Colors.white),
child: SizedBox.square(
dimension: 2 * avatarIconRadius,
child: rawPlayButton,
),
)
: rawPlayButton;

final children = <Widget>[
switch (audio?.audioType) {
AudioType.local => ShuffleButton(
Expand All @@ -51,7 +74,7 @@ class PlayerMainControls extends StatelessWidget with WatchItMixin {
AudioType.radio => IconButton(
tooltip: context.l10n.skipToLivStream,
onPressed: di<PlayerModel>().playNext,
icon: Icon(Iconz.refresh),
icon: Icon(Iconz.refresh, color: defaultColor),
),
_ => const SizedBox.shrink()
},
Expand All @@ -67,15 +90,7 @@ class PlayerMainControls extends StatelessWidget with WatchItMixin {
),
),
_flex,
CircleAvatar(
radius: avatarIconRadius,
backgroundColor:
avatarColor ?? (theme.isLight ? Colors.black : Colors.white),
child: PlayButton(
iconColor: iconColor ?? (theme.isLight ? Colors.white : Colors.black),
active: active,
),
),
playButton,
_flex,
if (showSkipButtons)
IconButton(
Expand All @@ -99,13 +114,16 @@ class PlayerMainControls extends StatelessWidget with WatchItMixin {
active: active,
iconColor: defaultColor,
),
AudioType.radio => const NextStationButton(),
AudioType.radio => NextStationButton(
iconColor: defaultColor,
),
_ => const SizedBox.shrink(),
},
];

return Row(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: mainAxisSize,
mainAxisAlignment: mainAxisAlignment,
children: children,
);
}
Expand Down
6 changes: 4 additions & 2 deletions lib/radio/view/next_station_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import '../../player/player_model.dart';
import '../../search/search_model.dart';

class NextStationButton extends StatelessWidget with WatchItMixin {
const NextStationButton({super.key});
const NextStationButton({super.key, this.iconColor});

final Color? iconColor;

@override
Widget build(BuildContext context) {
Expand All @@ -30,7 +32,7 @@ class NextStationButton extends StatelessWidget with WatchItMixin {
},
);
},
icon: Icon(Iconz.explore),
icon: Icon(Iconz.explore, color: iconColor),
);
}
}

0 comments on commit 9effd9c

Please sign in to comment.