From 7c5fae2ca1785a801ed895a4b38703c0ae76835f Mon Sep 17 00:00:00 2001 From: Frederik Feichtmeier Date: Tue, 16 Apr 2024 23:37:27 +0200 Subject: [PATCH] fix: Radio page is one large block of colour (#658) * fix: Radio page is one large block of colour Fixes #657 * Upgrade version --- lib/src/player/full_height_player.dart | 119 +++++++++--------- .../full_height_player_top_controls.dart | 89 +++++++------ .../open_radio_discover_page_button.dart | 2 +- macos/Podfile.lock | 9 +- pubspec.lock | 73 +++++------ pubspec.yaml | 7 +- 6 files changed, 153 insertions(+), 146 deletions(-) diff --git a/lib/src/player/full_height_player.dart b/lib/src/player/full_height_player.dart index d0b0ba580..d4e0f698b 100644 --- a/lib/src/player/full_height_player.dart +++ b/lib/src/player/full_height_player.dart @@ -1,9 +1,5 @@ -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'; @@ -11,6 +7,7 @@ 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'; @@ -72,7 +69,7 @@ class FullHeightPlayer extends StatelessWidget with WatchItMixin { ); } - final body = Stack( + final bodyWithControls = Stack( alignment: Alignment.topRight, children: [ if (isVideo) @@ -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 && @@ -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; } } diff --git a/lib/src/player/full_height_player_top_controls.dart b/lib/src/player/full_height_player_top_controls.dart index 8590874fc..499ccb78b 100644 --- a/lib/src/player/full_height_player_top_controls.dart +++ b/lib/src/player/full_height_player_top_controls.dart @@ -1,4 +1,7 @@ +import 'dart:io'; + import 'package:flutter/material.dart'; +import 'package:yaru/constants.dart'; import '../../common.dart'; import '../../data.dart'; @@ -14,6 +17,7 @@ class FullHeightPlayerTopControls extends StatelessWidget { required this.activeControls, required this.playerViewMode, required this.onFullScreenPressed, + required this.isVideo, }); final Audio? audio; @@ -21,47 +25,60 @@ class FullHeightPlayerTopControls extends StatelessWidget { 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, + ), + ], ), - ], + ), ); } } diff --git a/lib/src/radio/open_radio_discover_page_button.dart b/lib/src/radio/open_radio_discover_page_button.dart index 25d20607f..ad0bfab2e 100644 --- a/lib/src/radio/open_radio_discover_page_button.dart +++ b/lib/src/radio/open_radio_discover_page_button.dart @@ -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 diff --git a/macos/Podfile.lock b/macos/Podfile.lock index 4bd6fcff1..b588f59de 100644 --- a/macos/Podfile.lock +++ b/macos/Podfile.lock @@ -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): @@ -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): @@ -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 @@ -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 @@ -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 diff --git a/pubspec.lock b/pubspec.lock index 602e6413d..f3ebe106f 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -53,10 +53,10 @@ packages: dependency: transitive description: name: args - sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596 + sha256: "7cf60b9f0cc88203c5a190b4cd62a99feea42759a7fa695010eb5de1c0b2252a" url: "https://pub.dev" source: hosted - version: "2.4.2" + version: "2.5.0" async: dependency: transitive description: @@ -285,10 +285,10 @@ packages: dependency: "direct main" description: name: connectivity_plus - sha256: e9feae83b1849f61bad9f6f33ee00646e3410d54ce0821e02f262f9901dad3c9 + sha256: ebe15d94de9dd7c31dc2ac54e42780acdf3384b1497c69290c9f3c5b0279fc57 url: "https://pub.dev" source: hosted - version: "6.0.1" + version: "6.0.2" connectivity_plus_platform_interface: dependency: transitive description: @@ -333,10 +333,10 @@ packages: dependency: "direct main" description: name: cupertino_icons - sha256: d57953e10f9f8327ce64a508a355f0b1ec902193f66288e8cb5070e7c47eeb2d + sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 url: "https://pub.dev" source: hosted - version: "1.0.6" + version: "1.0.8" dart_style: dependency: transitive description: @@ -381,10 +381,10 @@ packages: dependency: "direct main" description: name: dio - sha256: "0978e9a3e45305a80a7210dbeaf79d6ee8bee33f70c8e542dc654c952070217f" + sha256: "11e40df547d418cc0c4900a9318b26304e665da6fa4755399a9ff9efd09034b5" url: "https://pub.dev" source: hosted - version: "5.4.2+1" + version: "5.4.3+1" equatable: dependency: transitive description: @@ -437,10 +437,10 @@ packages: dependency: transitive description: name: file_selector_ios - sha256: b015154e6d9fddbc4d08916794df170b44531798c8dd709a026df162d07ad81d + sha256: "0a1196a9c5795858aa315332da2fb5c4bcfdcb312d8a4e27651f765b87904431" url: "https://pub.dev" source: hosted - version: "0.5.1+8" + version: "0.5.1+9" file_selector_linux: dependency: "direct main" description: @@ -527,10 +527,10 @@ packages: dependency: "direct main" description: name: flutter_markdown - sha256: "31c12de79262b5431c5492e9c89948aa789158435f707d3519a7fdef6af28af7" + sha256: "04c4722cc36ec5af38acc38ece70d22d3c2123c61305d555750a091517bbe504" url: "https://pub.dev" source: hosted - version: "0.6.22+1" + version: "0.6.23" flutter_rust_bridge: dependency: transitive description: @@ -551,10 +551,10 @@ packages: dependency: "direct main" description: name: flutter_tabler_icons - sha256: bc7c5d44c3dd1621e086337dcb823567ba6de026375da0ed9c125b119921ee60 + sha256: "21d39936fcaee429c3a8d298b32ecc3f3f2c50829d6582dafde644e7ed2978ef" url: "https://pub.dev" source: hosted - version: "1.25.0" + version: "1.26.0" flutter_test: dependency: "direct dev" description: flutter @@ -585,10 +585,10 @@ packages: dependency: transitive description: name: get_it - sha256: ae30b28cc73053f79fd46b15f430db16cae22a0554e6cd25333c840b310b0270 + sha256: d85128a5dae4ea777324730dc65edd9c9f43155c109d5cc0a69cab74139fbac1 url: "https://pub.dev" source: hosted - version: "7.6.9" + version: "7.7.0" github: dependency: "direct main" description: @@ -986,18 +986,18 @@ packages: dependency: "direct main" description: name: path_provider - sha256: b27217933eeeba8ff24845c34003b003b2b22151de3c908d0e679e8fe1aa078b + sha256: c9e7d3a4cd1410877472158bee69963a4579f78b68c65a2b7d40d1a7a88bb161 url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.1.3" path_provider_android: dependency: transitive description: name: path_provider_android - sha256: "477184d672607c0a3bf68fbbf601805f92ef79c82b64b4d6eb318cbca4c48668" + sha256: a248d8146ee5983446bf03ed5ea8f6533129a12b11f12057ad1b4a67a2b3b41d url: "https://pub.dev" source: hosted - version: "2.2.2" + version: "2.2.4" path_provider_foundation: dependency: transitive description: @@ -1455,18 +1455,18 @@ packages: dependency: "direct main" description: name: url_launcher - sha256: "0ecc004c62fd3ed36a2ffcbe0dd9700aee63bd7532d0b642a488b1ec310f492e" + sha256: "6ce1e04375be4eed30548f10a315826fd933c1e493206eab82eed01f438c8d2e" url: "https://pub.dev" source: hosted - version: "6.2.5" + version: "6.2.6" url_launcher_android: dependency: transitive description: name: url_launcher_android - sha256: d4ed0711849dd8e33eb2dd69c25db0d0d3fdc37e0a62e629fe32f57a22db2745 + sha256: "360a6ed2027f18b73c8d98e159dda67a61b7f2e0f6ec26e86c3ada33b0621775" url: "https://pub.dev" source: hosted - version: "6.3.0" + version: "6.3.1" url_launcher_ios: dependency: transitive description: @@ -1503,10 +1503,10 @@ packages: dependency: transitive description: name: url_launcher_web - sha256: "3692a459204a33e04bc94f5fb91158faf4f2c8903281ddd82915adecdb1a901d" + sha256: "8d9e750d8c9338601e709cd0885f95825086bd8b642547f26bda435aade95d8a" url: "https://pub.dev" source: hosted - version: "2.3.0" + version: "2.3.1" url_launcher_windows: dependency: transitive description: @@ -1551,10 +1551,10 @@ packages: dependency: transitive description: name: wakelock_plus - sha256: cd641540ea98ce8f53649fd1430b73f15065c752d2996e9a07cbe9b2742634d7 + sha256: c8b7cc80f045533b40a0e6c9109905494e3cf32c0fbd5c62616998e0de44003f url: "https://pub.dev" source: hosted - version: "1.2.2" + version: "1.2.4" wakelock_plus_platform_interface: dependency: transitive description: @@ -1591,10 +1591,10 @@ packages: dependency: transitive description: name: web_socket_channel - sha256: "1d8e795e2a8b3730c41b8a98a2dff2e0fb57ae6f0764a1c46ec5915387d257b2" + sha256: "58c6666b342a38816b2e7e50ed0f1e261959630becd4c879c4f26bfa14aa5a42" url: "https://pub.dev" source: hosted - version: "2.4.4" + version: "2.4.5" win32: dependency: transitive description: @@ -1607,10 +1607,10 @@ packages: dependency: transitive description: name: win32_registry - sha256: "41fd8a189940d8696b1b810efb9abcf60827b6cbfab90b0c43e8439e3a39d85a" + sha256: "10589e0d7f4e053f2c61023a31c9ce01146656a70b7b7f0828c0b46d7da2a9bb" url: "https://pub.dev" source: hosted - version: "1.1.2" + version: "1.1.3" window_manager: dependency: "direct main" description: @@ -1646,10 +1646,11 @@ packages: yaru: dependency: "direct main" description: - name: yaru - sha256: e868965bcfbca568f54916e3f59a636a8a6ee39f2e102df8844061cd78a8d20e - url: "https://pub.dev" - source: hosted + path: "." + ref: "7b485d56d17576ff07964683c91d48eef1dc1297" + resolved-ref: "7b485d56d17576ff07964683c91d48eef1dc1297" + url: "https://github.com/ubuntu/yaru.dart" + source: git version: "4.1.0" yaru_window: dependency: "direct main" diff --git a/pubspec.yaml b/pubspec.yaml index 90d00a574..8246706f9 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: musicpod description: Ubuntu music, radio and podcast player. -version: 1.3.3 +version: 1.3.4 publish_to: "none" @@ -65,7 +65,10 @@ dependencies: watch_it: ^1.4.1 window_manager: ^0.3.8 xdg_directories: ^1.0.4 - yaru: ^4.1.0 + yaru: + git: + url: https://github.com/ubuntu/yaru.dart + ref: 7b485d56d17576ff07964683c91d48eef1dc1297 yaru_window: ^0.2.1 yaru_window_linux: ^0.2.0