diff --git a/lib/modules/library/widgets/library_gridview_widget.dart b/lib/modules/library/widgets/library_gridview_widget.dart index b71dedf..611b0ac 100644 --- a/lib/modules/library/widgets/library_gridview_widget.dart +++ b/lib/modules/library/widgets/library_gridview_widget.dart @@ -134,7 +134,7 @@ class _LibraryGridViewWidgetState extends State { ), child: Row( children: [ - if (widget.localSource && isLocalArchive) + if (widget.localSource || isLocalArchive) Container( decoration: BoxDecoration( borderRadius: const BorderRadius.only( @@ -151,12 +151,12 @@ class _LibraryGridViewWidgetState extends State { ), ), ), - if (widget.downloadedChapter) - Padding( - padding: const EdgeInsets.only(right: 5), - child: Consumer( - builder: (context, ref, child) { - List nbrDown = []; + Padding( + padding: const EdgeInsets.only(right: 5), + child: Consumer( + builder: (context, ref, child) { + List nbrDown = []; + if (widget.downloadedChapter) { isar.txnSync(() { for (var i = 0; i < entry.chapters.length; @@ -172,45 +172,54 @@ class _LibraryGridViewWidgetState extends State { if (entries.isNotEmpty && entries.first.isDownload!) { - nbrDown.add(entries.first); + nbrDown.add(1); } } }); + } - if (nbrDown.isNotEmpty) { - return Container( - decoration: BoxDecoration( - borderRadius: - const BorderRadius.only( - topLeft: - Radius.circular(3), - bottomLeft: - Radius.circular(3)), - color: - Theme.of(context).hintColor, - ), - child: Padding( - padding: const EdgeInsets.only( - left: 3, right: 3), - child: Text( - nbrDown.length.toString(), - style: const TextStyle( - color: Colors.white), + return Row( + children: [ + if (nbrDown.isNotEmpty && + widget.downloadedChapter) + Container( + decoration: BoxDecoration( + borderRadius: + const BorderRadius.only( + topLeft: + Radius.circular( + 3), + bottomLeft: + Radius.circular( + 3)), + color: Theme.of(context) + .secondaryHeaderColor, + ), + child: Padding( + padding: + const EdgeInsets.only( + left: 3, right: 3), + child: Text( + nbrDown.length.toString(), + ), ), ), - ); - } else { - return Container(); - } - }, - ), - ), - Padding( - padding: const EdgeInsets.only(right: 3), - child: Text( - entry.chapters.length.toString(), - style: - const TextStyle(color: Colors.white), + Padding( + padding: const EdgeInsets.only(left: 3), + child: Text( + entry.chapters + .where((element) => + !element.isRead!) + .length + .toString(), + style: TextStyle( + color: context + .dynamicBlackWhiteColor), + ), + ), + ], + ); + }, ), ), ], diff --git a/lib/utils/extensions/build_context_extensions.dart b/lib/utils/extensions/build_context_extensions.dart index ce167c9..2251f2f 100644 --- a/lib/utils/extensions/build_context_extensions.dart +++ b/lib/utils/extensions/build_context_extensions.dart @@ -19,6 +19,10 @@ extension BuildContextExtensions on BuildContext { return isLight ? Colors.black : Colors.white; } + Color get dynamicBlackWhiteColor { + return isLight ? Colors.white : Colors.black; + } + bool get isDesktop { return Platform.isMacOS || Platform.isLinux || Platform.isWindows; }