Skip to content

Commit

Permalink
billboard trending on home page
Browse files Browse the repository at this point in the history
  • Loading branch information
HemantKArya committed Mar 15, 2024
1 parent 5efb541 commit 7c9ed1b
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 8 deletions.
17 changes: 15 additions & 2 deletions lib/repository/Saavn/cubit/saavn_repository_cubit.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'dart:developer';
import 'package:Bloomee/plugins/billboard_charts.dart';
import 'package:bloc/bloc.dart';
import 'package:easy_debounce/easy_debounce.dart';
import 'package:rxdart/rxdart.dart';
Expand Down Expand Up @@ -30,12 +31,24 @@ class SaavnRepositoryCubit extends Cubit<SaavnRepositoryState> {
Future<void> fetchTopResultsfromSaavn() async {
emit(state);
final trends = await saavnAPI.getTopSearches();
final billboardIndia =
await getBillboardChart(url: BillboardChartLinks.INDIA_SONGS);

List<MediaItemModel> trendings = [];

for (int i = 0; i < trends.length; i++) {
try {
for (int i = 0; i < trends.length; i++) {
final trendingResults = await saavnAPI.fetchSongSearchResults(
searchQuery:
"${billboardIndia[i]["title"]} by ${billboardIndia[i]["label"]}",
count: 1);

trendings +=
fromSaavnSongMapList2MediaItemList(trendingResults["songs"]);
}
} catch (e) {
final trendingResults = await saavnAPI.fetchSongSearchResults(
searchQuery: trends[i], count: 2);
searchQuery: trends[0], count: 1);

trendings += fromSaavnSongMapList2MediaItemList(trendingResults["songs"]);
}
Expand Down
1 change: 0 additions & 1 deletion lib/repository/Saavn/saavn_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import 'dart:convert';
import 'dart:developer';
import 'package:http/http.dart';
import 'package:Bloomee/repository/Saavn/format.dart';
import 'package:logging/logging.dart';

class SaavnAPI {
Map<String, String> headers = {};
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 @@ -36,7 +36,7 @@ class _CaraouselWidgetState extends State<CaraouselWidget> {
child: Row(
children: [
Text(
"Trendings",
"Featured",
style: Default_Theme.secondoryTextStyle.merge(
const TextStyle(
color: Default_Theme.primaryColor1,
Expand Down
10 changes: 6 additions & 4 deletions lib/screens/widgets/tabList_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class _TabSongListWidgetState extends State<TabSongListWidget>
child: Padding(
padding: const EdgeInsets.only(left: 10, right: 10),
child: Text(
"Liked",
"Trending",
style: Default_Theme.secondoryTextStyle.merge(
const TextStyle(
color: Default_Theme.primaryColor1,
Expand Down Expand Up @@ -114,9 +114,11 @@ class SongListWidget extends StatelessWidget {
child: Padding(
padding: EdgeInsets.only(right: 70),
child: SizedBox(
height: 100,
width: 100,
child: CircularProgressIndicator()),
height: 60,
width: 60,
child: CircularProgressIndicator(
color: Default_Theme.accentColor2,
)),
),
);
} else {
Expand Down

0 comments on commit 7c9ed1b

Please sign in to comment.