-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Queue page added. Updated README.md. Bug fixes and improvements.
- Loading branch information
1 parent
97f5bc8
commit 8f22bf3
Showing
27 changed files
with
736 additions
and
535 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"cSpell.words": [ | ||
"albumart" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import 'package:bloc/bloc.dart'; | ||
import 'package:meloplay/src/data/models/search_result.dart'; | ||
import 'package:meloplay/src/data/repositories/search_repository.dart'; | ||
import 'package:meta/meta.dart'; | ||
|
||
part 'search_event.dart'; | ||
part 'search_state.dart'; | ||
|
||
class SearchBloc extends Bloc<SearchEvent, SearchState> { | ||
SearchBloc({required SearchRepository repository}) : super(SearchInitial()) { | ||
on<SearchQueryChanged>((event, emit) async { | ||
emit(SearchLoading()); | ||
final result = await repository.search(event.query); | ||
emit(SearchLoaded(searchResult: result)); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
part of 'search_bloc.dart'; | ||
|
||
@immutable | ||
sealed class SearchEvent {} | ||
|
||
class SearchQueryChanged extends SearchEvent { | ||
final String query; | ||
|
||
SearchQueryChanged(this.query); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
part of 'search_bloc.dart'; | ||
|
||
@immutable | ||
sealed class SearchState {} | ||
|
||
final class SearchInitial extends SearchState {} | ||
|
||
final class SearchLoading extends SearchState {} | ||
|
||
final class SearchLoaded extends SearchState { | ||
final SearchResultModel searchResult; | ||
SearchLoaded({required this.searchResult}); | ||
} | ||
|
||
final class SearchError extends SearchState { | ||
final String message; | ||
SearchError({required this.message}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
extension ListExtension<T> on List<T> { | ||
void swap(int first, int second) { | ||
if (first < length && second < length) { | ||
var temp = this[first]; | ||
this[first] = this[second]; | ||
this[second] = temp; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import 'package:on_audio_query/on_audio_query.dart'; | ||
|
||
class SearchResultModel { | ||
final List<SongModel> songs; | ||
final List<ArtistModel> artists; | ||
final List<AlbumModel> albums; | ||
final List<GenreModel> genres; | ||
|
||
SearchResultModel({ | ||
required this.songs, | ||
required this.artists, | ||
required this.albums, | ||
required this.genres, | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.