Merge branch 'SAVE_SONG_LDE'

FIX_LIKES_LDE
Lucas Delanier 2 years ago
commit fd4cb7b483

@ -23,6 +23,7 @@ class _SearchSongScreenState extends State<SearchSongScreen> {
final ScrollController _scrollController = ScrollController(); final ScrollController _scrollController = ScrollController();
final TextEditingController _textEditingController = TextEditingController(); final TextEditingController _textEditingController = TextEditingController();
PageController controller = PageController(); PageController controller = PageController();
bool isCollectionSelected = false;
int? playingIndex; int? playingIndex;
@ -83,6 +84,20 @@ class _SearchSongScreenState extends State<SearchSongScreen> {
} }
} }
_changePage(int index) {
/*if (isCollectionSelected) {
setState(() {
isCollectionSelected = !isCollectionSelected;
controller.animateTo(1, duration: Duration(milliseconds: 200), curve: Curves.easeOut);
});
} else {
setState(() {
isCollectionSelected = !isCollectionSelected;
controller.animateTo(0, duration: Duration(milliseconds: 200), curve: Curves.easeOut);
});
}*/
}
Future<List<Music>> _fetchSavedSong() async { Future<List<Music>> _fetchSavedSong() async {
return await MyApp.musicViewModel.getFavoriteMusicsByUserId(MyApp.userViewModel.userCurrent.id); return await MyApp.musicViewModel.getFavoriteMusicsByUserId(MyApp.userViewModel.userCurrent.id);
} }
@ -171,10 +186,45 @@ class _SearchSongScreenState extends State<SearchSongScreen> {
), ),
), ),
), ),
Padding(
padding: const EdgeInsets.only(top: 10, bottom: 20),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: _changePage(0),
child: Text(
"Recherche",
style: GoogleFonts.plusJakartaSans(
color: isCollectionSelected ? Color(0xFF9A9A9A) : Colors.white,
fontWeight: isCollectionSelected ? FontWeight.w500 : FontWeight.w700),
),
),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: _changePage(1),
child: Text("Collection",
style: GoogleFonts.plusJakartaSans(
color: isCollectionSelected ? Colors.white : Color(0xFF9A9A9A),
fontWeight: isCollectionSelected ? FontWeight.w700 : FontWeight.w500)),
),
],
),
),
Flexible( Flexible(
child: PageView( child: PageView(
controller: controller, controller: controller,
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
onPageChanged: (index) {
setState(() {
if (index == 1) {
isCollectionSelected = true;
} else {
isCollectionSelected = false;
}
});
},
children: [ children: [
ScrollConfiguration( ScrollConfiguration(
behavior: ScrollBehavior().copyWith(scrollbars: true), behavior: ScrollBehavior().copyWith(scrollbars: true),

Loading…
Cancel
Save