Skip to content

Commit

Permalink
PlayNow code implt.
Browse files Browse the repository at this point in the history
  • Loading branch information
HemantKArya committed Sep 9, 2024
1 parent 645cd99 commit facdb87
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 21 deletions.
7 changes: 5 additions & 2 deletions lib/screens/screen/common_views/album_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,11 @@ class _AlbumViewState extends State<AlbumView> {
song: state.album.songs[index],
onOptionsTap: () {
showMoreBottomSheet(
context, state.album.songs[index],
showDelete: false);
context,
state.album.songs[index],
showDelete: false,
showSinglePlay: true,
);
},
onTap: () {
if (context
Expand Down
7 changes: 5 additions & 2 deletions lib/screens/screen/common_views/artist_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,11 @@ class _ArtistViewState extends State<ArtistView> {
song: state.artist.songs[index],
onOptionsTap: () {
showMoreBottomSheet(
context, state.artist.songs[index],
showDelete: false);
context,
state.artist.songs[index],
showDelete: false,
showSinglePlay: true,
);
},
onTap: () {
if (context
Expand Down
7 changes: 5 additions & 2 deletions lib/screens/screen/common_views/playlist_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,11 @@ class _OnlPlaylistViewState extends State<OnlPlaylistView> {
song: state.playlist.songs[index],
onOptionsTap: () {
showMoreBottomSheet(
context, state.playlist.songs[index],
showDelete: false);
context,
state.playlist.songs[index],
showDelete: false,
showSinglePlay: true,
);
},
onTap: () {
if (context
Expand Down
6 changes: 4 additions & 2 deletions lib/screens/screen/home_views/youtube_views/playlist.dart
Original file line number Diff line number Diff line change
Expand Up @@ -475,8 +475,10 @@ class _YoutubePlaylistState extends State<YoutubePlaylist> {
isWide: true,
onOptionsTap: () {
showMoreBottomSheet(
context,
mediaitems[index]);
context,
mediaitems[index],
showSinglePlay: true,
);
},
onTap: () {
if (!listEquals(
Expand Down
28 changes: 16 additions & 12 deletions lib/screens/screen/library_views/playlist_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -461,18 +461,22 @@ class PlaylistView extends StatelessWidget {
}
},
onOptionsTap: () {
showMoreBottomSheet(context,
state.mediaPlaylist.mediaItems[index],
onDelete: () {
context
.read<BloomeeDBCubit>()
.removeMediaFromPlaylist(
state.mediaPlaylist.mediaItems[index],
MediaPlaylistDB(
playlistName: state
.mediaPlaylist.playlistName),
);
}, showDelete: true);
showMoreBottomSheet(
context,
state.mediaPlaylist.mediaItems[index],
onDelete: () {
context
.read<BloomeeDBCubit>()
.removeMediaFromPlaylist(
state.mediaPlaylist.mediaItems[index],
MediaPlaylistDB(
playlistName: state
.mediaPlaylist.playlistName),
);
},
showDelete: true,
showSinglePlay: true,
);
},
);
},
Expand Down
32 changes: 31 additions & 1 deletion lib/screens/widgets/more_bottom_sheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import 'package:Bloomee/services/db/cubit/bloomee_db_cubit.dart';
import 'package:Bloomee/theme_data/default.dart';
import 'package:Bloomee/services/file_manager.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';
import 'package:icons_plus/icons_plus.dart';
Expand All @@ -22,6 +21,7 @@ void showMoreBottomSheet(
BuildContext context,
MediaItemModel song, {
bool showDelete = false,
bool showSinglePlay = false,
VoidCallback? onDelete,
}) {
bool? isDownloaded;
Expand Down Expand Up @@ -73,6 +73,36 @@ void showMoreBottomSheet(
),
),
),
(showSinglePlay)
? ListTile(
leading: const Icon(
MingCute.play_circle_fill,
color: Default_Theme.primaryColor1,
size: 28,
),
title: const Text(
'Play Now',
style: TextStyle(
color: Default_Theme.primaryColor1,
fontFamily: "Unageo",
fontSize: 17,
fontWeight: FontWeight.w400),
),
onTap: () {
Navigator.pop(context);
context
.read<BloomeePlayerCubit>()
.bloomeePlayer
.addQueueItem(
song,
doPlay: true,
single: true,
);
SnackbarService.showMessage("Playing ${song.title}",
duration: const Duration(seconds: 2));
},
)
: const SizedBox.shrink(),
ListTile(
leading: const Icon(
MingCute.square_arrow_right_line,
Expand Down

0 comments on commit facdb87

Please sign in to comment.