From 268fea023e69c093421d10d59dd28e55e9dfb498 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karol=20Wr=C3=B3tniak?= Date: Fri, 9 Sep 2022 18:06:07 +0200 Subject: [PATCH] Don't draw active dot indicators for empty pagers. Fixes #1319 --- .../google/accompanist/pager/PagerIndicator.kt | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/pager-indicators/src/main/java/com/google/accompanist/pager/PagerIndicator.kt b/pager-indicators/src/main/java/com/google/accompanist/pager/PagerIndicator.kt index 60a8ce391..0731a080e 100644 --- a/pager-indicators/src/main/java/com/google/accompanist/pager/PagerIndicator.kt +++ b/pager-indicators/src/main/java/com/google/accompanist/pager/PagerIndicator.kt @@ -113,9 +113,12 @@ fun HorizontalPagerIndicator( ) } .size(width = indicatorWidth, height = indicatorHeight) - .background( - color = activeColor, - shape = indicatorShape, + .then( + if (pageCount > 0) Modifier.background( + color = activeColor, + shape = indicatorShape, + ) + else Modifier ) ) } @@ -195,9 +198,12 @@ fun VerticalPagerIndicator( ) } .size(width = indicatorWidth, height = indicatorHeight) - .background( - color = activeColor, - shape = indicatorShape, + .then( + if (pageCount > 0) Modifier.background( + color = activeColor, + shape = indicatorShape, + ) + else Modifier ) ) }