diff --git a/android/app/proguard-rules.pro b/android/app/proguard-rules.pro
new file mode 100644
index 0000000..116bc22
--- /dev/null
+++ b/android/app/proguard-rules.pro
@@ -0,0 +1 @@
+-keep class androidx.lifecycle.DefaultLifecycleObserver
\ No newline at end of file
diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index 3ad5a68..5ee36ce 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -2,6 +2,9 @@
xmlns:tools="http://schemas.android.com/tools">
+
+
+
diff --git a/lib/blocs/library/cubit/library_items_cubit.dart b/lib/blocs/library/cubit/library_items_cubit.dart
index 2432cad..6f5828b 100644
--- a/lib/blocs/library/cubit/library_items_cubit.dart
+++ b/lib/blocs/library/cubit/library_items_cubit.dart
@@ -91,4 +91,22 @@ class LibraryItemsCubit extends Cubit {
"Removed ${mediaItem.title} from ${mediaPlaylistDB.playlistName}");
}
}
+
+ Future?> getPlaylist(String playlistName) async {
+ try {
+ final playlistDB = mediaPlaylistsDB
+ .firstWhere((element) => element.playlistName == playlistName);
+ final _playlist = await BloomeeDBService.getPlaylistItems(playlistDB);
+
+ if (_playlist != null) {
+ final mediaItems =
+ _playlist.map((e) => MediaItemDB2MediaItem(e)).toList();
+ return mediaItems;
+ }
+ } catch (e) {
+ log("Error in getting playlist: $e", name: "libItemCubit");
+ return null;
+ }
+ return null;
+ }
}
diff --git a/lib/routes_and_consts/routes.dart b/lib/routes_and_consts/routes.dart
index 3773e78..b046ad5 100644
--- a/lib/routes_and_consts/routes.dart
+++ b/lib/routes_and_consts/routes.dart
@@ -50,9 +50,10 @@ class GlobalRoutes {
GoRoute(
name: GlobalStrConsts.playlistView,
// parentNavigatorKey: globalRouterKey,
- path: '/PlaylistView/:playlistName',
- builder: (context, state) => PlaylistView(
- playListName: state.pathParameters['playlistName'] ?? "none"),
+ path: '/PlaylistView',
+ builder: (context, state) {
+ return PlaylistView();
+ },
),
GoRoute(
path: '/AddToPlaylist',
diff --git a/lib/screens/screen/audioPlayer_screen.dart b/lib/screens/screen/audioPlayer_screen.dart
index 7679fee..22d419a 100644
--- a/lib/screens/screen/audioPlayer_screen.dart
+++ b/lib/screens/screen/audioPlayer_screen.dart
@@ -290,17 +290,29 @@ class _AudioPlayerViewState extends State {
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
- InkWell(
- onTap: () => musicPlayer.rewind(),
- child: const Icon(
+ IconButton(
+ padding: const EdgeInsets.all(5),
+ constraints: const BoxConstraints(),
+ style: const ButtonStyle(
+ tapTargetSize: MaterialTapTargetSize
+ .shrinkWrap, // the '2023' part
+ ),
+ onPressed: () => musicPlayer.rewind(),
+ icon: const Icon(
MingCute.refresh_4_line,
color: Default_Theme.primaryColor1,
size: 40,
),
),
- InkWell(
- onTap: () => musicPlayer.skipToPrevious(),
- child: const Icon(
+ IconButton(
+ padding: const EdgeInsets.all(5),
+ constraints: const BoxConstraints(),
+ style: const ButtonStyle(
+ tapTargetSize: MaterialTapTargetSize
+ .shrinkWrap, // the '2023' part
+ ),
+ onPressed: () => musicPlayer.skipToPrevious(),
+ icon: const Icon(
MingCute.skip_previous_fill,
color: Default_Theme.primaryColor1,
size: 40,
@@ -354,21 +366,33 @@ class _AudioPlayerViewState extends State {
);
});
}),
- InkWell(
- onTap: () => musicPlayer.skipToNext(),
- child: const Icon(
+ IconButton(
+ padding: const EdgeInsets.all(5),
+ constraints: const BoxConstraints(),
+ style: const ButtonStyle(
+ tapTargetSize: MaterialTapTargetSize
+ .shrinkWrap, // the '2023' part
+ ),
+ onPressed: () => musicPlayer.skipToNext(),
+ icon: const Icon(
MingCute.skip_forward_fill,
color: Default_Theme.primaryColor1,
size: 40,
),
),
- InkWell(
- child: const Icon(
+ IconButton(
+ padding: const EdgeInsets.all(5),
+ constraints: const BoxConstraints(),
+ style: const ButtonStyle(
+ tapTargetSize: MaterialTapTargetSize
+ .shrinkWrap, // the '2023' part
+ ),
+ icon: const Icon(
MingCute.external_link_line,
color: Default_Theme.primaryColor1,
size: 40,
),
- onTap: () {
+ onPressed: () {
launchUrlString(context
.read()
.bloomeePlayer
diff --git a/lib/screens/screen/chart/chart_view.dart b/lib/screens/screen/chart/chart_view.dart
index 3b0cf41..0ba781d 100644
--- a/lib/screens/screen/chart/chart_view.dart
+++ b/lib/screens/screen/chart/chart_view.dart
@@ -1,11 +1,9 @@
// ignore_for_file: public_member_api_docs, sort_constructors_first
-import 'package:Bloomee/blocs/explore/cubit/explore_cubits.dart';
import 'package:Bloomee/model/chart_model.dart';
import 'package:Bloomee/services/db/bloomee_db_service.dart';
import 'package:flutter/material.dart';
import 'package:Bloomee/screens/widgets/chart_list_tile.dart';
import 'package:Bloomee/theme_data/default.dart';
-import 'package:flutter_bloc/flutter_bloc.dart';
class ChartScreen extends StatefulWidget {
// ChartCubit? chartCubit;
diff --git a/lib/screens/screen/explore_screen.dart b/lib/screens/screen/explore_screen.dart
index d5e8035..792e7e8 100644
--- a/lib/screens/screen/explore_screen.dart
+++ b/lib/screens/screen/explore_screen.dart
@@ -1,6 +1,5 @@
import 'package:Bloomee/blocs/explore/cubit/explore_cubits.dart';
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/more_bottom_sheet.dart';
@@ -162,41 +161,50 @@ class _ExploreScreenState extends State {
style: Default_Theme.primaryTextStyle.merge(const TextStyle(
fontSize: 34, color: Default_Theme.primaryColor1))),
const Spacer(),
- Padding(
- padding: const EdgeInsets.only(right: 10),
- child: InkWell(
- splashColor: Colors.transparent,
- onTap: () {
- Navigator.push(
- context,
- MaterialPageRoute(
- builder: (context) => const NotificationView()));
- },
- child: const Icon(MingCute.notification_line,
- color: Default_Theme.primaryColor1, size: 30.0),
+ IconButton(
+ padding: const EdgeInsets.all(5),
+ constraints: const BoxConstraints(),
+ style: const ButtonStyle(
+ tapTargetSize:
+ MaterialTapTargetSize.shrinkWrap, // the '2023' part
),
+ onPressed: () {
+ Navigator.push(
+ context,
+ MaterialPageRoute(
+ builder: (context) => const NotificationView()));
+ },
+ icon: const Icon(MingCute.notification_line,
+ color: Default_Theme.primaryColor1, size: 30.0),
),
- Padding(
- padding: const EdgeInsets.only(right: 10),
- child: InkWell(
- splashColor: Colors.transparent,
- onTap: () {
- Navigator.push(context,
- MaterialPageRoute(builder: (context) => const TimerView()));
- },
- child: const Icon(MingCute.stopwatch_line,
- color: Default_Theme.primaryColor1, size: 30.0),
+ IconButton(
+ padding: EdgeInsets.all(5),
+ constraints: const BoxConstraints(),
+ style: const ButtonStyle(
+ tapTargetSize:
+ MaterialTapTargetSize.shrinkWrap, // the '2023' part
),
+ onPressed: () {
+ Navigator.push(context,
+ MaterialPageRoute(builder: (context) => const TimerView()));
+ },
+ icon: const Icon(MingCute.stopwatch_line,
+ color: Default_Theme.primaryColor1, size: 30.0),
),
- InkWell(
- splashColor: Colors.transparent,
- onTap: () {
+ IconButton(
+ padding: EdgeInsets.all(5),
+ constraints: const BoxConstraints(),
+ style: const ButtonStyle(
+ tapTargetSize:
+ MaterialTapTargetSize.shrinkWrap, // the '2023' part
+ ),
+ onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const SettingsView()));
},
- child: const Icon(MingCute.settings_3_line,
+ icon: const Icon(MingCute.settings_3_line,
color: Default_Theme.primaryColor1, size: 30.0)),
],
),
diff --git a/lib/screens/screen/library_screen.dart b/lib/screens/screen/library_screen.dart
index 045e24d..46e131a 100644
--- a/lib/screens/screen/library_screen.dart
+++ b/lib/screens/screen/library_screen.dart
@@ -1,3 +1,5 @@
+import 'package:Bloomee/screens/screen/library_views/cubit/current_playlist_cubit.dart';
+import 'package:Bloomee/screens/screen/library_views/more_opts_sheet.dart';
import 'package:Bloomee/screens/widgets/sign_board_widget.dart';
import 'package:Bloomee/utils/load_Image.dart';
import 'package:flutter/material.dart';
@@ -7,7 +9,6 @@ import 'package:Bloomee/blocs/library/cubit/library_items_cubit.dart';
import 'package:Bloomee/routes_and_consts/global_str_consts.dart';
import 'package:Bloomee/screens/widgets/createPlaylist_bottomsheet.dart';
import 'package:Bloomee/screens/widgets/smallPlaylistCard_widget.dart';
-import 'package:Bloomee/services/db/GlobalDB.dart';
import 'package:Bloomee/theme_data/default.dart';
import 'package:icons_plus/icons_plus.dart';
@@ -65,22 +66,34 @@ class LibraryScreen extends StatelessWidget {
style: Default_Theme.primaryTextStyle.merge(const TextStyle(
fontSize: 34, color: Default_Theme.primaryColor1))),
const Spacer(),
- InkWell(
- onTap: () {
- createPlaylistBottomSheet(context);
- },
- child: const Icon(MingCute.add_fill,
- size: 25, color: Default_Theme.primaryColor1),
- ),
- InkWell(
- onTap: () {
- context.pushNamed(GlobalStrConsts.ImportMediaFromPlatforms);
- },
- child: const Padding(
- padding: EdgeInsets.only(left: 10),
- child: Icon(FontAwesome.file_import_solid,
- size: 25, color: Default_Theme.primaryColor1),
- ),
+ ButtonBar(
+ buttonPadding: const EdgeInsets.all(0),
+ children: [
+ IconButton(
+ padding: const EdgeInsets.all(5),
+ constraints: const BoxConstraints(),
+ style: const ButtonStyle(
+ tapTargetSize:
+ MaterialTapTargetSize.shrinkWrap, // the '2023' part
+ ),
+ onPressed: () {
+ createPlaylistBottomSheet(context);
+ },
+ icon: const Icon(MingCute.add_fill,
+ size: 25, color: Default_Theme.primaryColor1)),
+ IconButton(
+ padding: const EdgeInsets.all(5),
+ constraints: const BoxConstraints(),
+ style: const ButtonStyle(
+ tapTargetSize:
+ MaterialTapTargetSize.shrinkWrap, // the '2023' part
+ ),
+ onPressed: () {
+ context.pushNamed(GlobalStrConsts.ImportMediaFromPlatforms);
+ },
+ icon: const Icon(FontAwesome.file_import_solid,
+ size: 25, color: Default_Theme.primaryColor1))
+ ],
),
],
),
@@ -89,8 +102,8 @@ class LibraryScreen extends StatelessWidget {
}
class ListOfPlaylists extends StatefulWidget {
- LibraryItemsState state;
- ListOfPlaylists({super.key, required this.state});
+ final LibraryItemsState state;
+ const ListOfPlaylists({super.key, required this.state});
@override
State createState() => _ListOfPlaylistsState();
@@ -109,47 +122,31 @@ class _ListOfPlaylistsState extends State {
return const SizedBox();
} else {
return Padding(
- padding: const EdgeInsets.only(bottom: 8),
- child: Dismissible(
- key: ValueKey(widget.state.playlists[index].playlistName),
- background: Container(
- color: Colors.red,
- child: const Row(
- children: [
- Padding(
- padding: EdgeInsets.only(left: 20),
- child: Icon(
- MingCute.delete_3_line,
- color: Colors.white,
- size: 30,
- ),
- ),
- Spacer(),
- ],
- ),
- ),
- direction: DismissDirection.startToEnd,
- onDismissed: (DismissDirection direction) {
- context.read().removePlaylist(
- MediaPlaylistDB(
- playlistName:
- widget.state.playlists[index].playlistName));
- setState(() {
- widget.state.playlists.removeAt(index);
- });
+ padding: const EdgeInsets.only(
+ bottom: 8,
+ ),
+ child: InkWell(
+ splashColor: Default_Theme.accentColor1.withOpacity(0.2),
+ hoverColor: Default_Theme.accentColor2.withOpacity(0.1),
+ highlightColor: Default_Theme.accentColor2.withOpacity(0.1),
+ borderRadius: BorderRadius.circular(10),
+ onLongPress: () {
+ showPlaylistOptsSheet(
+ context, widget.state.playlists[index].playlistName);
},
- child: InkWell(
- onTap: () => context
- .pushNamed(GlobalStrConsts.playlistView, pathParameters: {
- "playlistName": widget.state.playlists[index].playlistName
- }),
- child: SmallPlaylistCard(
- playListTitle: widget.state.playlists[index].playlistName,
- coverArt: loadImageCached(
- widget.state.playlists[index].coverImgUrl.toString()),
- playListsubTitle:
- widget.state.playlists[index].subTitle ?? "Unknown"),
- ),
+ onTap: () {
+ context.read().setupPlaylist(
+ widget.state.playlists[index].playlistName);
+ context.pushNamed(
+ GlobalStrConsts.playlistView,
+ );
+ },
+ child: SmallPlaylistCard(
+ playListTitle: widget.state.playlists[index].playlistName,
+ coverArt: loadImageCached(
+ widget.state.playlists[index].coverImgUrl.toString()),
+ playListsubTitle:
+ widget.state.playlists[index].subTitle ?? "Unknown"),
),
);
}
diff --git a/lib/screens/screen/library_views/cubit/current_playlist_cubit.dart b/lib/screens/screen/library_views/cubit/current_playlist_cubit.dart
index 9c9f70c..2e6dd86 100644
--- a/lib/screens/screen/library_views/cubit/current_playlist_cubit.dart
+++ b/lib/screens/screen/library_views/cubit/current_playlist_cubit.dart
@@ -1,19 +1,14 @@
// ignore_for_file: public_member_api_docs, sort_constructors_first
import 'package:bloc/bloc.dart';
+import 'package:equatable/equatable.dart';
import 'package:palette_generator/palette_generator.dart';
import 'package:Bloomee/model/MediaPlaylistModel.dart';
import 'package:Bloomee/model/songModel.dart';
import 'package:Bloomee/services/db/GlobalDB.dart';
import 'package:Bloomee/services/db/cubit/bloomee_db_cubit.dart';
import 'package:Bloomee/utils/pallete_generator.dart';
-
part 'current_playlist_state.dart';
-// load current playlist
-// return if data is loaded or not
-// provide fucntion to return length of playlist
-// provide album art
-
class CurrentPlaylistCubit extends Cubit {
MediaPlaylist? mediaPlaylist;
PaletteGenerator? paletteGenerator;
@@ -32,7 +27,7 @@ class CurrentPlaylistCubit extends Cubit {
emit(state.copyWith(
albumName: mediaPlaylist?.albumName,
isFetched: true,
- mediaItem: mediaPlaylist?.mediaItems));
+ mediaItem: List.from(mediaPlaylist!.mediaItems)));
}
}
@@ -49,7 +44,7 @@ class CurrentPlaylistCubit extends Cubit {
emit(state.copyWith(
albumName: mediaPlaylist?.albumName,
isFetched: true,
- mediaItem: mediaPlaylist?.mediaItems));
+ mediaItem: List.from(mediaPlaylist!.mediaItems)));
}
int getPlaylistLength() {
diff --git a/lib/screens/screen/library_views/cubit/current_playlist_state.dart b/lib/screens/screen/library_views/cubit/current_playlist_state.dart
index a12cafc..aec4c68 100644
--- a/lib/screens/screen/library_views/cubit/current_playlist_state.dart
+++ b/lib/screens/screen/library_views/cubit/current_playlist_state.dart
@@ -1,15 +1,15 @@
// ignore_for_file: public_member_api_docs, sort_constructors_first
part of 'current_playlist_cubit.dart';
-class CurrentPlaylistState extends MediaPlaylist {
+class CurrentPlaylistState extends Equatable {
bool isFetched;
- late List mediaItem;
- late String albumName;
+ List mediaItems;
+ String albumName;
CurrentPlaylistState({
required this.isFetched,
- required this.mediaItem,
+ required this.mediaItems,
required this.albumName,
- }) : super(albumName: albumName, mediaItems: mediaItem);
+ });
CurrentPlaylistState copyWith({
bool? isFetched,
@@ -18,18 +18,21 @@ class CurrentPlaylistState extends MediaPlaylist {
}) {
return CurrentPlaylistState(
isFetched: isFetched ?? this.isFetched,
- mediaItem: mediaItem ?? this.mediaItem,
+ mediaItems: mediaItem ?? mediaItems,
albumName: albumName ?? this.albumName,
);
}
+
+ @override
+ List