chore: bring back edit user playlist button

This commit is contained in:
Kingkor Roy Tirtho 2023-11-22 10:49:00 +06:00
parent 7d05c40dc0
commit 4511a0bd00
3 changed files with 17 additions and 21 deletions

View File

@ -63,26 +63,8 @@ class PlaybuttonCard extends HookWidget {
others: 15,
);
final textsHeight = useState(
(textsKey.currentContext?.findRenderObject() as RenderBox?)
?.size
.height ??
110.00,
);
final cleanDescription = useDescription(description);
useEffect(() {
WidgetsBinding.instance.addPostFrameCallback((_) {
textsHeight.value =
(textsKey.currentContext?.findRenderObject() as RenderBox?)
?.size
.height ??
textsHeight.value;
});
return null;
}, [textsKey]);
return Container(
constraints: BoxConstraints(maxWidth: size),
margin: margin,

View File

@ -3,6 +3,7 @@ import 'package:flutter/services.dart';
import 'package:go_router/go_router.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:spotube/collections/spotube_icons.dart';
import 'package:spotube/components/playlist/playlist_create_dialog.dart';
import 'package:spotube/components/shared/heart_button.dart';
import 'package:spotube/components/shared/tracks_view/sections/body/use_is_user_playlist.dart';
import 'package:spotube/components/shared/tracks_view/track_view_props.dart';
@ -76,6 +77,21 @@ class TrackViewHeaderActions extends HookConsumerWidget {
}
},
),
if (isUserPlaylist)
IconButton(
icon: const Icon(SpotubeIcons.edit),
onPressed: () {
showDialog(
context: context,
builder: (context) {
return PlaylistCreateDialog(
playlistId: props.collectionId,
trackIds: props.tracks.map((e) => e.id!).toList(),
);
},
);
},
),
],
);
}

View File

@ -131,10 +131,8 @@ class PlaylistMutations {
);
}
},
refreshQueries: [
"playlist/$playlistId",
],
refreshInfiniteQueries: [
"playlist/$playlistId",
"current-user-playlists",
],
ref: ref,