Skip to content

Commit

Permalink
new song card impl.
Browse files Browse the repository at this point in the history
  • Loading branch information
HemantKArya committed Mar 25, 2024
1 parent 9b10106 commit f9eccd4
Show file tree
Hide file tree
Showing 7 changed files with 295 additions and 339 deletions.
5 changes: 5 additions & 0 deletions lib/screens/screen/audioPlayer_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,11 @@ class _AudioPlayerViewState extends State<AudioPlayerView> {
? Default_Theme.accentColor1
: Default_Theme.accentColor2,
thumbRadius: 0,
bufferedBarColor: snapshot
.data?.currentPlayerState.playing ??
false
? Default_Theme.accentColor1.withOpacity(0.2)
: Default_Theme.accentColor2.withOpacity(0.2),
barHeight: 4,
);
}),
Expand Down
44 changes: 19 additions & 25 deletions lib/screens/screen/explore_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import 'package:Bloomee/blocs/mediaPlayer/bloomee_player_cubit.dart';
import 'package:Bloomee/model/MediaPlaylistModel.dart';
import 'package:Bloomee/routes_and_consts/global_str_consts.dart';
import 'package:Bloomee/screens/widgets/chart_list_tile.dart';
import 'package:Bloomee/screens/widgets/singleSongCard_widget.dart';
import 'package:Bloomee/screens/widgets/mediaItemOptions_bottomsheet.dart';
import 'package:Bloomee/screens/widgets/song_card_widget.dart';
import 'package:Bloomee/services/db/cubit/bloomee_db_cubit.dart';
import 'package:Bloomee/utils/app_updater.dart';
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -83,30 +84,23 @@ class _ExploreScreenState extends State<ExploreScreen> {
? TabSongListWidget(
list: state.mediaPlaylist.mediaItems
.map((e) {
return Padding(
padding: const EdgeInsets.only(
bottom: 8.0,
right: 10,
left: 15,
),
child: SingleSongCardWidget(
titleText: e.title,
subText: e.artist ?? "",
artUri: e.artUri.toString(),
showLiked: false,
onClicked: () {
context
.read<BloomeePlayerCubit>()
.bloomeePlayer
.loadPlaylist(
MediaPlaylist(
mediaItems: [e],
albumName: "Recently",
),
doPlay: true,
);
},
),
return SongCardWidget(
song: e,
onTap: () {
context
.read<BloomeePlayerCubit>()
.bloomeePlayer
.loadPlaylist(
MediaPlaylist(
mediaItems: [e],
albumName: "Recently",
),
doPlay: true,
);
},
onOptionsTap: () =>
showMediaItemOptions(
context, e),
);
}).toList(),
category: "Recently",
Expand Down
81 changes: 44 additions & 37 deletions lib/screens/screen/library_views/playlist_screen.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
import 'dart:developer';

import 'package:Bloomee/screens/widgets/mediaItemOptions_bottomsheet.dart';
import 'package:Bloomee/screens/widgets/sign_board_widget.dart';
import 'package:Bloomee/screens/widgets/song_card_widget.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';
import 'package:icons_plus/icons_plus.dart';
import 'package:just_audio/just_audio.dart';
import 'package:Bloomee/model/songModel.dart';
import 'package:Bloomee/screens/screen/library_views/cubit/current_playlist_cubit.dart';
import 'package:Bloomee/screens/widgets/horizontalSongCard_widget.dart';
import 'package:Bloomee/screens/widgets/playPause_widget.dart';
import 'package:Bloomee/services/db/GlobalDB.dart';
import 'package:Bloomee/services/db/cubit/bloomee_db_cubit.dart';
Expand All @@ -21,7 +27,7 @@ class PlaylistView extends StatelessWidget {
Key? key,
required this.playListName,
}) : super(key: key) {
print("Showing playlist: $playListName");
log("Showing playlist: $playListName", name: "PlaylistView");
}
Future<void> setUpPlaylist(BuildContext context) async {
context.read<CurrentPlaylistCubit>().loadPlaylist(playListName);
Expand Down Expand Up @@ -150,7 +156,7 @@ class PlaylistView extends StatelessWidget {
})),
Positioned(
top: 280,
left: 20,
left: 14,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expand Down Expand Up @@ -210,15 +216,10 @@ class PlaylistView extends StatelessWidget {
),
);
} else {
return Center(
child: Wrap(
children: [
Text(
"Get started by adding items to library!!",
style: Default_Theme.secondoryTextStyle.merge(
const TextStyle(color: Default_Theme.primaryColor2)),
)
],
return const Center(
child: SignBoardWidget(
message: "No Songs in Playlist",
icon: MingCute.music_2_line,
),
);
}
Expand Down Expand Up @@ -260,22 +261,6 @@ class _PlaylistState extends State<Playlist> {
],
),
),
// secondaryBackground: Container(
// color: Colors.red,
// child: const Row(
// children: [
// Spacer(),
// Padding(
// padding: EdgeInsets.only(right: 20),
// child: Icon(
// MingCute.delete_3_line,
// color: Colors.white,
// size: 30,
// ),
// ),
// ],
// ),
// ),
onDismissed: (direction) {
context.read<BloomeeDBCubit>().removeMediaFromPlaylist(
_state.mediaItem[index],
Expand All @@ -285,14 +270,36 @@ class _PlaylistState extends State<Playlist> {
});
},
key: ValueKey(_state.mediaItems[index].id),
child: Padding(
padding: const EdgeInsets.only(bottom: 5, left: 12, right: 5),
child: HorizontalSongCardWidget(
mediaPlaylist: _state,
index: index,
boxWidth: MediaQuery.of(context).size.width * 0.9,
showLiked: true,
),
child: SongCardWidget(
song: _state.mediaItems[index],
onTap: () {
if (!listEquals(
context
.read<BloomeePlayerCubit>()
.bloomeePlayer
.currentPlaylist,
_state.mediaItems)) {
context
.read<BloomeePlayerCubit>()
.bloomeePlayer
.loadPlaylist(_state, idx: index, doPlay: true);
// context.read<BloomeePlayerCubit>().bloomeePlayer.play();
} else if (context
.read<BloomeePlayerCubit>()
.bloomeePlayer
.currentMedia !=
_state.mediaItems[index]) {
context
.read<BloomeePlayerCubit>()
.bloomeePlayer
.prepare4play(idx: index, doPlay: true);
}

context.push('/MusicPlayer');
},
onOptionsTap: () {
showMediaItemOptions(context, _state.mediaItems[index]);
},
),
);
},
Expand Down Expand Up @@ -323,7 +330,7 @@ Widget proxyDecorator(Widget child, int index, Animation<double> animation) {
return Material(
elevation: elevation,
color: Default_Theme.accentColor2.withOpacity(0.3),
borderRadius: BorderRadius.circular(15),
borderRadius: BorderRadius.circular(12),
shadowColor: Colors.transparent,
child: child,
);
Expand Down
44 changes: 37 additions & 7 deletions lib/screens/screen/search_screen.dart
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
// ignore_for_file: public_member_api_docs, sort_constructors_first
import 'dart:developer';

import 'package:Bloomee/blocs/mediaPlayer/bloomee_player_cubit.dart';
import 'package:Bloomee/screens/widgets/mediaItemOptions_bottomsheet.dart';
import 'package:Bloomee/screens/widgets/sign_board_widget.dart';
import 'package:Bloomee/screens/widgets/song_card_widget.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';
import 'package:icons_plus/icons_plus.dart';

import 'package:Bloomee/blocs/internet_connectivity/cubit/connectivity_cubit.dart';
import 'package:Bloomee/blocs/search/fetch_search_results.dart';
import 'package:Bloomee/screens/screen/search_views/search_page.dart';
import 'package:Bloomee/screens/widgets/horizontalSongCard_widget.dart';
import 'package:Bloomee/theme_data/default.dart';

class SearchScreen extends StatefulWidget {
Expand Down Expand Up @@ -188,12 +192,38 @@ class _SearchScreenState extends State<SearchScreen> {
itemCount: state.mediaItems.length,
itemBuilder: (context, index) {
return Padding(
padding: const EdgeInsets.only(
left: 18, bottom: 5, right: 18),
child: HorizontalSongCardWidget(
index: index,
mediaPlaylist: state,
showLiked: true,
padding: const EdgeInsets.only(left: 4),
child: SongCardWidget(
song: state.mediaItems[index],
onTap: () {
if (!listEquals(
context
.read<BloomeePlayerCubit>()
.bloomeePlayer
.currentPlaylist,
state.mediaItems)) {
context
.read<BloomeePlayerCubit>()
.bloomeePlayer
.loadPlaylist(state,
idx: index, doPlay: true);
// context.read<BloomeePlayerCubit>().bloomeePlayer.play();
} else if (context
.read<BloomeePlayerCubit>()
.bloomeePlayer
.currentMedia !=
state.mediaItems[index]) {
context
.read<BloomeePlayerCubit>()
.bloomeePlayer
.prepare4play(
idx: index, doPlay: true);
}

context.push('/MusicPlayer');
},
onOptionsTap: () => showMediaItemOptions(
context, state.mediaItems[index]),
),
);
},
Expand Down
30 changes: 14 additions & 16 deletions lib/screens/widgets/carousal_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';
import 'package:Bloomee/routes_and_consts/global_str_consts.dart';
import 'package:Bloomee/theme_data/default.dart';
import 'package:icons_plus/icons_plus.dart';

class CaraouselWidget extends StatefulWidget {
CaraouselWidget({
Expand Down Expand Up @@ -63,24 +61,24 @@ class _CaraouselWidgetState extends State<CaraouselWidget> {
child: AnimatedOpacity(
duration: const Duration(milliseconds: 80),
opacity: _visibility ? 1.0 : 0.0,
child: Padding(
padding: const EdgeInsets.only(left: 15, top: 10),
child: const Padding(
padding: EdgeInsets.only(left: 15, top: 10),
child: RotatedBox(
quarterTurns: 3,
child: Row(
children: [
Text(
"Featured",
style: Default_Theme.secondoryTextStyle.merge(
const TextStyle(
color: Default_Theme.primaryColor1,
fontWeight: FontWeight.bold,
fontSize: 19)),
),
const Icon(
FontAwesome.bolt_lightning_solid,
color: Default_Theme.primaryColor1,
),
// Text(
// "Featured",
// style: Default_Theme.secondoryTextStyle.merge(
// const TextStyle(
// color: Default_Theme.primaryColor1,
// fontWeight: FontWeight.bold,
// fontSize: 19)),
// ),
// const Icon(
// FontAwesome.bolt_lightning_solid,
// color: Default_Theme.primaryColor1,
// ),
],
),
),
Expand Down
Loading

0 comments on commit f9eccd4

Please sign in to comment.