Created
March 14, 2022 08:55
-
-
Save EmmanuelGuther/fb476aa270c90187e13f259346ea88b0 to your computer and use it in GitHub Desktop.
Jetpack compose tabRow implementation
This file contains hidden or 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 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