Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: show queue or radiohistory when the player is big enough #888

Merged
merged 1 commit into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 38 additions & 30 deletions lib/common/view/header_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -80,37 +80,45 @@ class HeaderBar extends StatelessWidget
: YaruTitleBarStyle.undecorated;
}

return YaruWindowTitleBar(
titleSpacing: titleSpacing,
actions: [
if ((!context.showMasterPanel && Platform.isMacOS) && leading != null)
Padding(
padding: const EdgeInsets.only(left: 10),
child: leading,
),
...?actions,
],
leading: !context.showMasterPanel && Platform.isMacOS ? null : leading,
title: title,
border: BorderSide.none,
backgroundColor: backgroundColor ?? context.theme.scaffoldBackgroundColor,
style: theStyle,
foregroundColor: foregroundColor,
onClose: Platform.isLinux
? (context) {
switch (closeBtnAction) {
case CloseBtnAction.alwaysAsk:
showDialog(
context: context,
builder: (_) => const CloseWindowActionConfirmDialog(),
);
case CloseBtnAction.hideToTray:
YaruWindow.hide(context);
case CloseBtnAction.close:
YaruWindow.close(context);
return Theme(
data: context.t.copyWith(
appBarTheme: AppBarTheme.of(context).copyWith(
scrolledUnderElevation: 0,
),
),
child: YaruWindowTitleBar(
titleSpacing: titleSpacing,
actions: [
if ((!context.showMasterPanel && Platform.isMacOS) && leading != null)
Padding(
padding: const EdgeInsets.only(left: 10),
child: leading,
),
...?actions,
],
leading: !context.showMasterPanel && Platform.isMacOS ? null : leading,
title: title,
border: BorderSide.none,
backgroundColor:
backgroundColor ?? context.theme.scaffoldBackgroundColor,
style: theStyle,
foregroundColor: foregroundColor,
onClose: Platform.isLinux
? (context) {
switch (closeBtnAction) {
case CloseBtnAction.alwaysAsk:
showDialog(
context: context,
builder: (_) => const CloseWindowActionConfirmDialog(),
);
case CloseBtnAction.hideToTray:
YaruWindow.hide(context);
case CloseBtnAction.close:
YaruWindow.close(context);
}
}
}
: null,
: null,
),
);
}

Expand Down
4 changes: 4 additions & 0 deletions lib/player/player_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ class PlayerService {
Audio? get audio => _audio;
void _setAudio(Audio value) async {
if (value == _audio) return;
if (value.audioType != _audio?.audioType) {
_shuffle = false;
setRate(1);
}
_audio = value;
_audioController.add(true);
setMpvMetaData(null);
Expand Down
170 changes: 78 additions & 92 deletions lib/player/view/bottom_player.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,107 +43,93 @@ class BottomPlayer extends StatelessWidget with WatchItMixin {
m.queue.length > 1 || audio?.audioType == AudioType.local,
);

final bottomPlayerImage = ClipRRect(
borderRadius: BorderRadius.circular(4),
child: BottomPlayerImage(
audio: audio,
size: kBottomPlayerHeight - 24,
videoController: model.controller,
isVideo: isVideo,
isOnline: isOnline,
),
);

final titleAndArtist = BottomPlayerTitleArtist(
audio: audio,
);

final bottomPlayerControls = PlayerMainControls(
playPrevious: model.playPrevious,
playNext: model.playNext,
active: active,
);

final track = PlayerTrack(
active: active,
bottomPlayer: true,
);

final bottom = Padding(
padding: const EdgeInsets.symmetric(vertical: 10),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
final player = SizedBox(
height: kBottomPlayerHeight,
child: Column(
children: [
Padding(
padding: const EdgeInsets.only(left: 10, right: 20),
child: bottomPlayerImage,
PlayerTrack(
active: active,
bottomPlayer: true,
),
Expanded(
flex: 4,
child: Row(
children: [
Flexible(
flex: 5,
child: titleAndArtist,
),
if (!smallWindow)
InkWell(
onTap: () => appModel.setFullWindowMode(true),
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 10),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Padding(
padding: const EdgeInsets.only(left: 10),
child: switch (audio?.audioType) {
AudioType.local => LikeIcon(
audio: audio,
color: theme.colorScheme.onSurface,
padding: const EdgeInsets.only(left: 10, right: 20),
child: ClipRRect(
borderRadius: BorderRadius.circular(4),
child: BottomPlayerImage(
audio: audio,
size: kBottomPlayerHeight - 24,
videoController: model.controller,
isVideo: isVideo,
isOnline: isOnline,
),
),
),
Expanded(
flex: 4,
child: Row(
children: [
Flexible(
flex: 5,
child: BottomPlayerTitleArtist(
audio: audio,
),
),
AudioType.radio => RadioLikeIcon(audio: audio),
_ => const SizedBox.shrink(),
},
if (!smallWindow)
Padding(
padding: const EdgeInsets.only(left: 10),
child: switch (audio?.audioType) {
AudioType.local => LikeIcon(
audio: audio,
color: theme.colorScheme.onSurface,
),
AudioType.radio => RadioLikeIcon(audio: audio),
_ => const SizedBox.shrink(),
},
),
],
),
),
],
),
),
if (!smallWindow)
Expanded(
flex: 6,
child: bottomPlayerControls,
),
if (!smallWindow)
Flexible(
flex: 4,
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
if (audio?.audioType == AudioType.podcast)
PlaybackRateButton(active: active),
const VolumeSliderPopup(),
if (showQueueButton) const QueueButton(),
IconButton(
tooltip: context.l10n.fullWindow,
icon: Icon(
Iconz().fullWindow,
color: theme.colorScheme.onSurface,
if (!smallWindow)
Expanded(
flex: 6,
child: PlayerMainControls(active: active),
),
onPressed: () => appModel.setFullWindowMode(true),
if (!smallWindow)
Flexible(
flex: 4,
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
if (audio?.audioType == AudioType.podcast)
PlaybackRateButton(active: active),
const VolumeSliderPopup(),
if (showQueueButton) const QueueButton(),
IconButton(
tooltip: context.l10n.fullWindow,
icon: Icon(
Iconz().fullWindow,
color: theme.colorScheme.onSurface,
),
onPressed: () => appModel.setFullWindowMode(true),
),
],
),
)
else
PlayButton(active: active),
const SizedBox(
width: 10,
),
],
),
)
else
PlayButton(active: active),
const SizedBox(
width: 10,
),
],
),
);

final player = SizedBox(
height: kBottomPlayerHeight,
child: Column(
children: [
track,
InkWell(
onTap: () => appModel.setFullWindowMode(true),
child: bottom,
),
),
],
),
Expand Down
Loading