Skip to content

Commit

Permalink
fix: Radio page is one large block of colour (#658)
Browse files Browse the repository at this point in the history
* fix: Radio page is one large block of colour
Fixes #657

* Upgrade version
  • Loading branch information
Feichtmeier authored Apr 16, 2024
1 parent 06ac7ff commit 7c5fae2
Show file tree
Hide file tree
Showing 6 changed files with 153 additions and 146 deletions.
119 changes: 56 additions & 63 deletions lib/src/player/full_height_player.dart
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
import 'dart:io';

import 'package:flutter/material.dart';

import 'package:media_kit_video/media_kit_video.dart';
import '../../get.dart';
import 'package:yaru/yaru.dart';

import '../../app.dart';
import '../../build_context_x.dart';
import '../../common.dart';
import '../../constants.dart';
import '../../data.dart';
import '../../get.dart';
import '../../player.dart';
import 'blurred_full_height_player_image.dart';
import 'full_height_player_image.dart';
Expand Down Expand Up @@ -72,7 +69,7 @@ class FullHeightPlayer extends StatelessWidget with WatchItMixin {
);
}

final body = Stack(
final bodyWithControls = Stack(
alignment: Alignment.topRight,
children: [
if (isVideo)
Expand Down Expand Up @@ -118,24 +115,13 @@ class FullHeightPlayer extends StatelessWidget with WatchItMixin {
),
),
),
Padding(
padding: EdgeInsets.only(
right: kYaruPagePadding,
top: Platform.isMacOS ? 0 : kYaruPagePadding,
),
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(100),
color: isVideo ? Colors.black.withOpacity(0.6) : null,
),
child: FullHeightPlayerTopControls(
audio: audio,
iconColor: iconColor,
activeControls: activeControls,
playerViewMode: playerViewMode,
onFullScreenPressed: onFullScreenPressed,
),
),
FullHeightPlayerTopControls(
audio: audio,
iconColor: iconColor,
activeControls: activeControls,
playerViewMode: playerViewMode,
onFullScreenPressed: onFullScreenPressed,
isVideo: isVideo,
),
if (nextAudio?.title != null &&
nextAudio?.artist != null &&
Expand All @@ -152,56 +138,63 @@ class FullHeightPlayer extends StatelessWidget with WatchItMixin {
],
);

final fullHeightPlayer = Column(
children: [
if (!isMobile)
HeaderBar(
adaptive: false,
title: const Text(
'',
maxLines: 1,
overflow: TextOverflow.ellipsis,
final body = isMobile
? GestureDetector(
onVerticalDragEnd: (details) {
if (details.primaryVelocity != null &&
details.primaryVelocity! > 150) {
appModel.setFullScreen(false);
}
},
child: Padding(
padding: const EdgeInsets.only(top: 40),
child: bodyWithControls,
),
foregroundColor: isVideo == true ? Colors.white : null,
backgroundColor:
isVideo == true ? Colors.black : Colors.transparent,
),
isMobile
? Expanded(
child: GestureDetector(
onVerticalDragEnd: (details) {
if (details.primaryVelocity != null &&
details.primaryVelocity! > 150) {
appModel.setFullScreen(false);
}
},
child: Padding(
padding: const EdgeInsets.only(top: 40),
child: body,
),
),
)
: Expanded(
)
: bodyWithControls;

final headerBar = HeaderBar(
adaptive: false,
title: const Text(
'',
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
foregroundColor: isVideo == true ? Colors.white : null,
backgroundColor: isVideo == true ? Colors.black : Colors.transparent,
);

final fullHeightPlayer = isVideo
? Scaffold(
backgroundColor: Colors.black,
appBar: headerBar,
body: body,
)
: Column(
children: [
if (!isMobile) headerBar,
Expanded(
child: body,
),
],
);
],
);

if ((audio?.imageUrl != null ||
audio?.albumArtUrl != null ||
audio?.pictureData != null)) {
audio?.albumArtUrl != null ||
audio?.pictureData != null) &&
isOnline &&
!isVideo) {
return Stack(
children: [
if (isOnline)
BlurredFullHeightPlayerImage(
size: size,
audio: audio,
),
BlurredFullHeightPlayerImage(
size: size,
audio: audio,
),
fullHeightPlayer,
],
);
} else {
return fullHeightPlayer;
}

return fullHeightPlayer;
}
}
89 changes: 53 additions & 36 deletions lib/src/player/full_height_player_top_controls.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import 'dart:io';

import 'package:flutter/material.dart';
import 'package:yaru/constants.dart';

import '../../common.dart';
import '../../data.dart';
Expand All @@ -14,54 +17,68 @@ class FullHeightPlayerTopControls extends StatelessWidget {
required this.activeControls,
required this.playerViewMode,
required this.onFullScreenPressed,
required this.isVideo,
});

final Audio? audio;
final Color iconColor;
final bool activeControls;
final PlayerViewMode playerViewMode;
final void Function() onFullScreenPressed;
final bool isVideo;

@override
Widget build(BuildContext context) {
return Wrap(
alignment: WrapAlignment.end,
spacing: 5.0,
children: [
if (audio?.audioType != AudioType.podcast)
PlayerLikeIcon(
audio: audio,
color: iconColor,
),
QueueButton(
color: iconColor,
),
ShareButton(
audio: audio,
active: activeControls,
color: iconColor,
),
if (audio?.audioType == AudioType.podcast)
PlaybackRateButton(
active: activeControls,
color: iconColor,
),
VolumeSliderPopup(
color: iconColor,
return Padding(
padding: EdgeInsets.only(
right: kYaruPagePadding,
top: Platform.isMacOS ? 0 : kYaruPagePadding,
),
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(100),
color: isVideo ? Colors.black.withOpacity(0.6) : null,
),
IconButton(
tooltip: playerViewMode == PlayerViewMode.fullWindow
? context.l10n.leaveFullWindow
: context.l10n.fullWindow,
icon: Icon(
playerViewMode == PlayerViewMode.fullWindow
? Iconz().fullScreenExit
: Iconz().fullScreen,
color: iconColor,
),
onPressed: onFullScreenPressed,
child: Wrap(
alignment: WrapAlignment.end,
spacing: 5.0,
children: [
if (audio?.audioType != AudioType.podcast)
PlayerLikeIcon(
audio: audio,
color: iconColor,
),
QueueButton(
color: iconColor,
),
ShareButton(
audio: audio,
active: activeControls,
color: iconColor,
),
if (audio?.audioType == AudioType.podcast)
PlaybackRateButton(
active: activeControls,
color: iconColor,
),
VolumeSliderPopup(
color: iconColor,
),
IconButton(
tooltip: playerViewMode == PlayerViewMode.fullWindow
? context.l10n.leaveFullWindow
: context.l10n.fullWindow,
icon: Icon(
playerViewMode == PlayerViewMode.fullWindow
? Iconz().fullScreenExit
: Iconz().fullScreen,
color: iconColor,
),
onPressed: onFullScreenPressed,
),
],
),
],
),
);
}
}
2 changes: 1 addition & 1 deletion lib/src/radio/open_radio_discover_page_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import '../../globals.dart';
import '../../l10n.dart';
import 'radio_discover_page.dart';

class OpenRadioDiscoverPageButton extends StatelessWidget {
class OpenRadioDiscoverPageButton extends StatelessWidget with WatchItMixin {
const OpenRadioDiscoverPageButton({super.key});

@override
Expand Down
9 changes: 1 addition & 8 deletions macos/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ PODS:
- connectivity_plus (0.0.1):
- Flutter
- FlutterMacOS
- ReachabilitySwift
- device_info_plus (0.0.1):
- FlutterMacOS
- file_selector_macos (0.0.1):
Expand All @@ -25,7 +24,6 @@ PODS:
- path_provider_foundation (0.0.1):
- Flutter
- FlutterMacOS
- ReachabilitySwift (5.0.0)
- screen_brightness_macos (0.1.0):
- FlutterMacOS
- screen_retriever (0.0.1):
Expand Down Expand Up @@ -66,10 +64,6 @@ DEPENDENCIES:
- wakelock_plus (from `Flutter/ephemeral/.symlinks/plugins/wakelock_plus/macos`)
- window_manager (from `Flutter/ephemeral/.symlinks/plugins/window_manager/macos`)

SPEC REPOS:
trunk:
- ReachabilitySwift

EXTERNAL SOURCES:
audio_service:
:path: Flutter/ephemeral/.symlinks/plugins/audio_service/macos
Expand Down Expand Up @@ -115,7 +109,7 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
audio_service: b88ff778e0e3915efd4cd1a5ad6f0beef0c950a9
audio_session: dea1f41890dbf1718f04a56f1d6150fd50039b72
connectivity_plus: e2dad488011aeb593e219360e804c43cc1af5770
connectivity_plus: ddd7f30999e1faaef5967c23d5b6d503d10434db
device_info_plus: 5401765fde0b8d062a2f8eb65510fb17e77cf07f
file_selector_macos: 468fb6b81fac7c0e88d71317f3eec34c3b008ff9
FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24
Expand All @@ -125,7 +119,6 @@ SPEC CHECKSUMS:
media_kit_video: c75b07f14d59706c775778e4dd47dd027de8d1e5
package_info_plus: fa739dd842b393193c5ca93c26798dff6e3d0e0c
path_provider_foundation: 3784922295ac71e43754bd15e0653ccfd36a147c
ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825
screen_brightness_macos: 2d6d3af2165592d9a55ffcd95b7550970e41ebda
screen_retriever: 59634572a57080243dd1bf715e55b6c54f241a38
sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec
Expand Down
Loading

0 comments on commit 7c5fae2

Please sign in to comment.