@@ -951,29 +951,33 @@ class SidePanel extends StatelessWidget {
951951 const TextStyle (fontSize: 10 , color: Colors .white),
952952 ),
953953 ),
954- title: RichText (
955- text: TextSpan (
956- style: const TextStyle (color: Colors .white, fontSize: 14 ),
957- children: [
958- TextSpan (text: item.audiobookTitle),
959- if (snapshot.hasData) ...[
960- TextSpan (
961- text: ' \u 200E${snapshot .data !['duration' ]}' ,
962- style: const TextStyle (color: Colors .lightBlue),
954+ title: RichText (
955+ text: TextSpan (
956+ style: const TextStyle (color: Colors .white, fontSize: 14 ),
957+ children: [
958+ TextSpan (text: item.audiobookTitle),
959+ if (snapshot.hasData) ...[
960+ TextSpan (
961+ text: ' \u 200E${snapshot .data !['duration' ]}' ,
962+ style: const TextStyle (color: Colors .lightBlue),
963+ ),
964+ if (snapshot.data! ['progress' ] != null &&
965+ snapshot.data! ['progress' ].toString ().isNotEmpty &&
966+ _parseProgress (
967+ snapshot.data! ['progress' ].toString ()) >
968+ 0.9 )
969+ TextSpan (
970+ text: ' \u 200E${snapshot .data !['progress' ]}' ,
971+ style: TextStyle (color: Colors .purple[200 ]),
972+ ),
973+ ],
974+ TextSpan (
975+ text: ' \u 200E${_daysAgoLabel (item .lastPlayed )}' ,
976+ style: const TextStyle (color: Colors .white38),
977+ ),
978+ ],
963979 ),
964- if (snapshot.data! ['progress' ] != null &&
965- snapshot.data! ['progress' ].toString ().isNotEmpty &&
966- _parseProgress (
967- snapshot.data! ['progress' ].toString ()) >
968- 0.9 )
969- TextSpan (
970- text: ' \u 200E${snapshot .data !['progress' ]}' ,
971- style: TextStyle (color: Colors .purple[200 ]),
972- ),
973- ],
974- ],
975- ),
976- ),
980+ ),
977981 subtitle: Text (
978982 '$ltr ${item .chapterTitle } • ${_formatDuration (item .lastPosition )}' ,
979983 style: const TextStyle (color: Colors .white54, fontSize: 12 ),
@@ -990,6 +994,18 @@ class SidePanel extends StatelessWidget {
990994 );
991995 }
992996
997+ String _daysAgoLabel (DateTime lastPlayed) {
998+ final now = DateTime .now ();
999+ final today = DateTime (now.year, now.month, now.day);
1000+ final playedDay =
1001+ DateTime (lastPlayed.year, lastPlayed.month, lastPlayed.day);
1002+ final days = today.difference (playedDay).inDays;
1003+
1004+ if (days <= 0 ) return 'today' ;
1005+ if (days == 1 ) return 'yesterday' ;
1006+ return '-${days }d' ;
1007+ }
1008+
9931009 Widget _buildPlaylistList (BuildContext context) {
9941010 final filteredPlaylist = getFilteredPlaylist ();
9951011
0 commit comments