chore: hide songlink when not youtube track

This commit is contained in:
Kingkor Roy Tirtho 2024-03-08 19:12:40 +06:00
parent ca76a39910
commit b354f57d4e

View File

@ -24,6 +24,7 @@ import 'package:spotube/models/local_track.dart';
import 'package:spotube/pages/lyrics/lyrics.dart'; import 'package:spotube/pages/lyrics/lyrics.dart';
import 'package:spotube/provider/authentication_provider.dart'; import 'package:spotube/provider/authentication_provider.dart';
import 'package:spotube/provider/proxy_playlist/proxy_playlist_provider.dart'; import 'package:spotube/provider/proxy_playlist/proxy_playlist_provider.dart';
import 'package:spotube/services/sourced_track/sources/youtube.dart';
import 'package:spotube/utils/type_conversion_utils.dart'; import 'package:spotube/utils/type_conversion_utils.dart';
import 'package:url_launcher/url_launcher_string.dart'; import 'package:url_launcher/url_launcher_string.dart';
@ -138,26 +139,25 @@ class PlayerView extends HookConsumerWidget {
onPressed: panelController.close, onPressed: panelController.close,
), ),
actions: [ actions: [
TextButton.icon( if (currentTrack is YoutubeSourcedTrack)
icon: Assets.logos.songlinkTransparent.image( TextButton.icon(
width: 20, icon: Assets.logos.songlinkTransparent.image(
height: 20, width: 20,
color: bodyTextColor, height: 20,
), color: bodyTextColor,
label: Text(context.l10n.song_link), ),
style: TextButton.styleFrom( label: Text(context.l10n.song_link),
foregroundColor: bodyTextColor, style: TextButton.styleFrom(
padding: EdgeInsets.zero, foregroundColor: bodyTextColor,
), padding: EdgeInsets.zero,
onPressed: currentTrack == null ),
? null onPressed: () {
: () { final url =
final url = "https://song.link/s/${currentTrack.id}";
"https://song.link/s/${currentTrack.id}";
launchUrlString(url); launchUrlString(url);
}, },
), ),
IconButton( IconButton(
icon: const Icon(SpotubeIcons.info, size: 18), icon: const Icon(SpotubeIcons.info, size: 18),
tooltip: context.l10n.details, tooltip: context.l10n.details,