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/provider/authentication_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:url_launcher/url_launcher_string.dart';
@ -138,26 +139,25 @@ class PlayerView extends HookConsumerWidget {
onPressed: panelController.close,
),
actions: [
TextButton.icon(
icon: Assets.logos.songlinkTransparent.image(
width: 20,
height: 20,
color: bodyTextColor,
),
label: Text(context.l10n.song_link),
style: TextButton.styleFrom(
foregroundColor: bodyTextColor,
padding: EdgeInsets.zero,
),
onPressed: currentTrack == null
? null
: () {
final url =
"https://song.link/s/${currentTrack.id}";
if (currentTrack is YoutubeSourcedTrack)
TextButton.icon(
icon: Assets.logos.songlinkTransparent.image(
width: 20,
height: 20,
color: bodyTextColor,
),
label: Text(context.l10n.song_link),
style: TextButton.styleFrom(
foregroundColor: bodyTextColor,
padding: EdgeInsets.zero,
),
onPressed: () {
final url =
"https://song.link/s/${currentTrack.id}";
launchUrlString(url);
},
),
launchUrlString(url);
},
),
IconButton(
icon: const Icon(SpotubeIcons.info, size: 18),
tooltip: context.l10n.details,