Skip to content

Instantly share code, notes, and snippets.

@EmmanuelGuther
Created March 14, 2022 08:55
Show Gist options
  • Select an option

  • Save EmmanuelGuther/fb476aa270c90187e13f259346ea88b0 to your computer and use it in GitHub Desktop.

Select an option

Save EmmanuelGuther/fb476aa270c90187e13f259346ea88b0 to your computer and use it in GitHub Desktop.
Jetpack compose tabRow implementation
@Composable
fun IconTab(daysEnergyHistoric: DaysEnergyHistoric) {
var tabIndex by remember { mutableStateOf(0) }
val tabData = daysEnergyHistoric.toList()
TabRow(selectedTabIndex = tabIndex) {
tabData.forEachIndexed { index, pair ->
Tab(selected = tabIndex == index, onClick = {
tabIndex = index
}, text = {
Text(text = pair.readableDate)
}, icon = { CircularIcon( Icons.Filled.DateRange, "date icon") })
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment