@@ -61,7 +61,7 @@ class RecentlyPlayedSongs extends StatelessWidget {
6161 ),
6262 ),
6363 title: Text (
64- "Recently Played Songs " ,
64+ "Recently Played" ,
6565 style: Theme .of (context).textTheme.headline4,
6666 ),
6767 ),
@@ -71,21 +71,32 @@ class RecentlyPlayedSongs extends StatelessWidget {
7171 valueListenable: Hive .box ('RecentlyPlayed' ).listenable (),
7272 builder: (context, box, child) {
7373 if (box.isEmpty) {
74- return const Text ("no liked songs" );
74+ return const SizedBox (
75+ height: 300 ,
76+ child: Center (
77+ child: Text (
78+ "You don't have any Recently played songs" ,
79+ style: TextStyle (
80+ color: Colors .white,
81+ fontSize: 16 ,
82+ ),
83+ ),
84+ ),
85+ );
7586 }
87+
7688 return ListView .builder (
7789 shrinkWrap: true ,
7890 physics: const NeverScrollableScrollPhysics (),
7991 itemBuilder: (context, i) {
8092 final info = Hive .box ('RecentlyPlayed' ).getAt (i);
8193 data.add (info);
82-
8394 return Dismissible (
8495 key: Key (info['songname' ].toString ()),
85- onDismissed: (direction) {
86- box.deleteAt (i);
96+ onDismissed: (direction) async {
97+ await box.deleteAt (i);
8798 context.showSnackBar (
88- message: "Removed from liked songs." );
99+ message: "Removed from recent songs." );
89100 },
90101 direction: DismissDirection .endToStart,
91102 background: Container (
@@ -100,6 +111,8 @@ class RecentlyPlayedSongs extends StatelessWidget {
100111 ),
101112 child: ListTile (
102113 onTap: () {
114+ data.sort (
115+ (a, b) => a["created" ].compareTo (b["created" ]));
103116 con.playSong (con.converLocalSongToAudio (data), i);
104117 },
105118 leading: ClipRRect (
0 commit comments