Created
March 18, 2023 21:07
-
-
Save Ahmad-Hamwi/5fb4304740ecc748095c0629d0480b20 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
@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