@@ -50,36 +50,104 @@ abstract class GlobalParameters {
5050 imageUrl:
5151 'https://sun2-3.userapi.com/impf/c857632/v857632634/42976/g6UFFRU2X4s.jpg?size=592x592&quality=96&sign=50f681a1964bb7cc8049dd7db53578e8&type=audio' ,
5252 ),
53+ Song (
54+ id: 3 ,
55+ title: 'Dragonborn' ,
56+ artists: ['Big Baby Tape' ],
57+ feat: [],
58+ duration: '3:09' ,
59+ imageUrl:
60+ 'https://sun2-10.userapi.com/impf/c849228/v849228340/c2dd5/0KZPjgB-zt0.jpg?size=592x592&quality=96&sign=ce2dc2db9e841a07b403f0d691772eb0&type=audio' ,
61+ ),
62+ Song (
63+ id: 4 ,
64+ title: 'Привычка' ,
65+ artists: ['Скриптонит' ],
66+ feat: ['Andy Panda' , '104' ],
67+ duration: '3:16' ,
68+ imageUrl:
69+ 'https://sun2-9.userapi.com/impf/NS7bO5bXFp3l1B1HdI_tQSyFKr4YLPen4rnU5Q/2kYTNB5ljmg.jpg?size=592x592&quality=96&sign=40e1fa138ed05380cb6fed3d2a0c1749&type=audio' ,
70+ ),
71+ Song (
72+ id: 5 ,
73+ title: 'Rain (from Suicide Squad)' ,
74+ artists: ['grandson' , 'Jessie Reyez' ],
75+ feat: [],
76+ duration: '3:56' ,
77+ imageUrl:
78+ 'https://sun2-12.userapi.com/impf/uTcGjQn135E_3iRwF2yiL7S5YmqJp9hzGz5O_A/zbQVtydXD3Q.jpg?size=592x592&quality=96&sign=312b342b4f52c5badbb61edbfe1ec119&type=audio' ,
79+ ),
80+ Song (
81+ id: 6 ,
82+ title: 'Batman' ,
83+ artists: ['LPB Poody' ],
84+ feat: [],
85+ duration: '2:36' ,
86+ imageUrl:
87+ 'https://sun2-4.userapi.com/impf/c857332/v857332204/188aa2/6FfPjj7ZGjY.jpg?size=592x592&quality=96&sign=c82ecefc9400c91941b97b8ef8835e8f&type=audio' ,
88+ ),
89+ Song (
90+ id: 7 ,
91+ title: 'Drip or Drown' ,
92+ artists: ['Gunna' ],
93+ feat: [],
94+ duration: '2:06' ,
95+ imageUrl:
96+ 'https://sun2-11.userapi.com/impf/c858032/v858032821/4a222/sxDplVHIfl8.jpg?size=592x592&quality=96&sign=978c7a7e88cbe024ac524599d3c10b52&type=audio' ,
97+ ),
5398 ];
5499
55100 static final SnappingSheetController snappingSheetController =
56101 SnappingSheetController ();
102+ static AnimationController playAnimationController;
103+ static AnimationController waveController;
57104 static final ValueNotifier <bool > playNotifier = ValueNotifier (false );
58105 static final ValueNotifier <Song > currentSong = ValueNotifier (songs[0 ]);
59106 static int songId = songs[0 ].id;
60107 static final ValueNotifier <double > songSeconds = ValueNotifier (0.0 );
61108 static final ValueNotifier <bool > shuffleMode = ValueNotifier (false );
62109 static final ValueNotifier <bool > repeatOneMode = ValueNotifier (false );
63110
64- static void previousSong () {
111+ static void playPauseSong () {
112+ if (playNotifier.value) {
113+ playNotifier.value = false ;
114+ playAnimationController.reverse ();
115+ waveController.reverse ();
116+ } else {
117+ playNotifier.value = true ;
118+ playAnimationController.forward ();
119+ waveController.forward ();
120+ }
121+ }
122+
123+ static void playSongByID (int id) async {
124+ songId = id;
125+ await songs[songId].generateColors ();
126+ currentSong.value = songs[songId];
127+ songSeconds.value = 0 ;
128+ }
129+
130+ static void previousSong () async {
65131 if (songs.length > 0 ) {
66132 if (songId != 0 ) {
67133 songId-- ;
68134 } else {
69135 songId = songs.length - 1 ;
70136 }
137+ await songs[songId].generateColors ();
71138 currentSong.value = songs[songId];
72139 songSeconds.value = 0 ;
73140 }
74141 }
75142
76- static void nextSong () {
143+ static void nextSong () async {
77144 if (songs.length > 0 ) {
78145 if (songId != songs.length - 1 ) {
79146 songId++ ;
80147 } else {
81148 songId = 0 ;
82149 }
150+ await songs[songId].generateColors ();
83151 currentSong.value = songs[songId];
84152 songSeconds.value = 0 ;
85153 }
0 commit comments