Skip to content

Instantly share code, notes, and snippets.

@Ahmad-Hamwi
Created March 18, 2023 21:07
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 Ahmad-Hamwi/5fb4304740ecc748095c0629d0480b20 to your computer and use it in GitHub Desktop.
Save Ahmad-Hamwi/5fb4304740ecc748095c0629d0480b20 to your computer and use it in GitHub Desktop.
@Composable
fun MyTabBar(
categories: List<Category>,
selectedTabIndex: Int,
onTabClicked: (index: Int, category: Category) -> Unit
) {
ScrollableTabRow(
selectedTabIndex = selectedTabIndex,
edgePadding = 0.dp
) {
categories.forEachIndexed { index, category ->
Tab(
selected = index == selectedTabIndex,
onClick = { onTabClicked(index, category) },
text = { Text(category.name.uppercase()) }
)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment