Skip to content

Instantly share code, notes, and snippets.

@aqua30
Last active May 1, 2023 17:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aqua30/13ae95a1deaccf889c7248519ab152e8 to your computer and use it in GitHub Desktop.
Save aqua30/13ae95a1deaccf889c7248519ab152e8 to your computer and use it in GitHub Desktop.
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