Skip to content

Commit

Permalink
library cubit fix
Browse files Browse the repository at this point in the history
  • Loading branch information
HemantKArya committed Mar 24, 2024
1 parent 0f34e70 commit bd46e33
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 10 deletions.
13 changes: 8 additions & 5 deletions lib/blocs/library/cubit/library_items_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,16 @@ class LibraryItemsCubit extends Cubit<LibraryItemsState> {
}
}

void addToPlaylist(
MediaItemModel mediaItem, MediaPlaylistDB mediaPlaylistDB) {
Future<void> addToPlaylist(
MediaItemModel mediaItem, MediaPlaylistDB mediaPlaylistDB) async {
if (mediaPlaylistDB.playlistName != "Null") {
bloomeeDBCubit.addMediaItemToPlaylist(mediaItem, mediaPlaylistDB);
final _tempID = await bloomeeDBCubit.addMediaItemToPlaylist(
mediaItem, mediaPlaylistDB);
getAndEmitPlaylists();
SnackbarService.showMessage(
"Added ${mediaItem.title} to ${mediaPlaylistDB.playlistName}");
// log("Added to playlist - ${mediaPlaylistDB.playlistName} - $_tempID",
// name: "libItemCubit");
// SnackbarService.showMessage(
// "Added ${mediaItem.title} to ${mediaPlaylistDB.playlistName}");
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/blocs/library/cubit/library_items_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class PlaylistItemProperties extends Equatable {
});

@override
List<Object?> get props => [playlistName];
List<Object?> get props => [playlistName, coverImgUrl, subTitle];
}

class LibraryItemsState extends Equatable {
Expand Down
2 changes: 1 addition & 1 deletion lib/screens/screen/library_views/playlist_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ class PlaylistView extends StatelessWidget {
),
),
Text(
"Youtube-SPotify",
"Playlist",
style: Default_Theme.secondoryTextStyle
.merge(TextStyle(
color: Default_Theme.primaryColor1
Expand Down
2 changes: 1 addition & 1 deletion lib/screens/widgets/carousal_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class _CaraouselWidgetState extends State<CaraouselWidget> {
},
height: 320.0,
viewportFraction: 0.7,
autoPlay: true,
// autoPlay: true,
autoPlayInterval: const Duration(milliseconds: 2500),
// aspectRatio: 15 / 16,
// enableInfiniteScroll: true,
Expand Down
5 changes: 3 additions & 2 deletions lib/services/db/cubit/bloomee_db_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -164,16 +164,17 @@ class BloomeeDBCubit extends Cubit<MediadbState> {

Future<void> removeMediaItemFromDB(MediaItemDB mediaItemDB) async {}

Future<void> addMediaItemToPlaylist(
Future<int?> addMediaItemToPlaylist(
MediaItemModel mediaItemModel, MediaPlaylistDB mediaPlaylistDB,
{bool undo = false}) async {
BloomeeDBService.addMediaItem(
final _id = await BloomeeDBService.addMediaItem(
MediaItem2MediaItemDB(mediaItemModel), mediaPlaylistDB);
// refreshLibrary.add(true);
if (!undo) {
SnackbarService.showMessage(
"${mediaItemModel.title} is added to ${mediaPlaylistDB.playlistName}!!");
}
return _id;
}

Future<bool?> getSettingBool(String key) async {
Expand Down

0 comments on commit bd46e33

Please sign in to comment.