Last active
May 1, 2023 17:42
-
-
Save aqua30/13ae95a1deaccf889c7248519ab152e8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TabRow( | |
modifier = Modifier.fillMaxWidth(), | |
selectedTabIndex = selectedPage, | |
indicator = { tabPositions -> | |
} | |
) { | |
homeTabs.forEachIndexed { index, tabData -> | |
Tab( | |
selected = index == selectedPage, | |
) { | |
tabData.unreadCount?.let { count -> | |
Row( // if we find that either status count or call count is greater than 0 then we show this row | |
verticalAlignment = Alignment.CenterVertically, | |
horizontalArrangement = Arrangement.Center | |
) { | |
Text( | |
text = tabData.tab.value, | |
style = TextStyle( | |
fontSize = 16.sp, | |
) | |
) | |
if (tabData.tab.sameAs(Tabs.MESSAGE_STATUS)) { | |
AnimatedVisibility(visible = statusIndicatorVisible) { | |
TabIndicator() | |
} | |
} else { | |
AnimatedVisibility(visible = callIndicatorVisible) { | |
UnreadCountIndicator(count) | |
} | |
} | |
} | |
}?: Text( // else we show simple text | |
text = tabData.tab.value, | |
style = TextStyle( | |
fontSize = 16.sp, | |
) | |
) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment