From a8e6ddc51e68bf7d5fbfafd82057f05a73a4e62c Mon Sep 17 00:00:00 2001 From: Anxcye Date: Sat, 10 Aug 2024 13:05:12 +0800 Subject: [PATCH] feat: add percentage at book cover --- lib/widgets/book_item.dart | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/lib/widgets/book_item.dart b/lib/widgets/book_item.dart index 15c146a..ef96485 100644 --- a/lib/widgets/book_item.dart +++ b/lib/widgets/book_item.dart @@ -62,12 +62,25 @@ class BookItem extends StatelessWidget { overflow: TextOverflow.ellipsis, style: const TextStyle(fontWeight: FontWeight.bold), ), - Text( - book.author, - style: const TextStyle( - fontWeight: FontWeight.w300, - fontSize: 9, - overflow: TextOverflow.ellipsis), + Row( + children: [ + Expanded( + child: Text( + book.author, + style: const TextStyle( + fontWeight: FontWeight.w300, + fontSize: 9, + overflow: TextOverflow.ellipsis), + ), + ), + Text( + '${book.readingPercentage.toStringAsFixed(0)}%', + style: const TextStyle( + fontWeight: FontWeight.w300, + fontSize: 9, + overflow: TextOverflow.ellipsis), + ), + ], ), ], ),