-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
176 additions
and
1 deletion.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
lib/src/features/songs/presentation/songs_list_screen/songs_list_filter_screen.dart
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,52 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_riverpod/flutter_riverpod.dart'; | ||
import 'package:vocadb_app/src/features/songs/presentation/songs_list_screen/songs_list_params_state.dart'; | ||
import 'package:vocadb_app/src/features/songs/presentation/widgets/dropdown_song_sort.dart'; | ||
import 'package:vocadb_app/src/features/songs/presentation/widgets/dropdown_song_types.dart'; | ||
import 'package:vocadb_app/src/features/tags/presentation/tag_widgets/tag_input.dart'; | ||
|
||
class SongsFilterScreen extends StatelessWidget { | ||
const SongsFilterScreen( | ||
{super.key, this.onSortChanged, this.onSongTypesChanged}); | ||
|
||
final Function(String?)? onSongTypesChanged; | ||
|
||
final Function(String?)? onSortChanged; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
appBar: AppBar( | ||
title: const Text('Filter'), | ||
), | ||
body: Consumer( | ||
builder: (context, ref, child) { | ||
final state = ref.watch(songsListParamsStateProvider); | ||
|
||
return ListView( | ||
children: [ | ||
DropdownSongTypes( | ||
value: state.songTypes ?? '', | ||
onChanged: (value) => | ||
onSongTypesChanged?.call(value) ?? | ||
ref | ||
.read(songsListParamsStateProvider.notifier) | ||
.updateSongTypes(value!), | ||
), | ||
DropdownSongSort( | ||
value: 'Name', | ||
onChanged: (value) => | ||
onSortChanged?.call(value) ?? | ||
ref | ||
.read(songsListParamsStateProvider.notifier) | ||
.updateSort(value!), | ||
), | ||
const Divider(), | ||
const TagInput(), | ||
], | ||
); | ||
}, | ||
), | ||
); | ||
} | ||
} |
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
44 changes: 44 additions & 0 deletions
44
lib/src/features/songs/presentation/widgets/dropdown_song_sort.dart
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,44 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:vocadb_app/src/common_widgets/dropdown_tile.dart'; | ||
|
||
class DropdownSongSort extends StatelessWidget { | ||
const DropdownSongSort({super.key, required this.value, this.onChanged}); | ||
|
||
static const dropdownKey = Key('dropdown-artist-sort-key'); | ||
|
||
final String value; | ||
|
||
final Function(String?)? onChanged; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return DropdownTile( | ||
dropdownButtonKey: dropdownKey, | ||
value: value, | ||
label: 'Sort', | ||
onChanged: onChanged, | ||
items: const [ | ||
DropdownMenuItem<String>( | ||
value: 'Name', | ||
child: Text('Name'), | ||
), | ||
DropdownMenuItem<String>( | ||
value: 'AdditionDate', | ||
child: Text('Addition date'), | ||
), | ||
DropdownMenuItem<String>( | ||
value: 'PublishDate', | ||
child: Text('Publish date'), | ||
), | ||
DropdownMenuItem<String>( | ||
value: 'FavoritedTimes', | ||
child: Text('Times favorited'), | ||
), | ||
DropdownMenuItem<String>( | ||
value: 'RatingScore', | ||
child: Text('Rating score'), | ||
), | ||
], | ||
); | ||
} | ||
} |
64 changes: 64 additions & 0 deletions
64
lib/src/features/songs/presentation/widgets/dropdown_song_types.dart
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,64 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:vocadb_app/src/common_widgets/dropdown_tile.dart'; | ||
|
||
class DropdownSongTypes extends StatelessWidget { | ||
const DropdownSongTypes({super.key, required this.value, this.onChanged}); | ||
|
||
static const dropdownKey = Key('dropdown-song-types-key'); | ||
|
||
final String value; | ||
|
||
final Function(String?)? onChanged; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return DropdownTile( | ||
dropdownButtonKey: dropdownKey, | ||
value: value, | ||
label: 'Song Types', | ||
onChanged: onChanged, | ||
items: const [ | ||
DropdownMenuItem<String>( | ||
value: '', | ||
child: Text('Unspecified'), | ||
), | ||
DropdownMenuItem<String>( | ||
value: 'Original', | ||
child: Text('Original song'), | ||
), | ||
DropdownMenuItem<String>( | ||
value: 'Remaster', | ||
child: Text('Remaster'), | ||
), | ||
DropdownMenuItem<String>( | ||
value: 'Remix', | ||
child: Text('Remix'), | ||
), | ||
DropdownMenuItem<String>( | ||
value: 'Cover', | ||
child: Text('Cover'), | ||
), | ||
DropdownMenuItem<String>( | ||
value: 'Instrumental', | ||
child: Text('Instrumental'), | ||
), | ||
DropdownMenuItem<String>( | ||
value: 'Mashup', | ||
child: Text('Mashup'), | ||
), | ||
DropdownMenuItem<String>( | ||
value: 'MusicPV', | ||
child: Text('Music PV'), | ||
), | ||
DropdownMenuItem<String>( | ||
value: 'DramaPV', | ||
child: Text('Drama PV'), | ||
), | ||
DropdownMenuItem<String>( | ||
value: 'Other', | ||
child: Text('Other'), | ||
), | ||
], | ||
); | ||
} | ||
} |
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