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
Column( | |
modifier = Modifier | |
.padding(contentPadding) | |
) { | |
TabRow( | |
//... | |
) { | |
//... | |
} | |
HorizontalPager( |
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
Column( | |
modifier = Modifier | |
.padding(contentPadding) | |
) { | |
TabRow( | |
//.. | |
) { | |
tabRowItems.forEachIndexed { index, item -> | |
Tab( | |
selected = pagerState.currentPage == index, |
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
Column( | |
modifier = Modifier | |
.padding(contentPadding) | |
) { | |
TabRow( | |
selectedTabIndex = pagerState.currentPage, | |
indicator = { tabPositions -> | |
TabRowDefaults.Indicator( | |
Modifier.pagerTabIndicatorOffset(pagerState, tabPositions), | |
color = MaterialTheme.colors.secondary |
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
val pagerState = rememberPagerState() | |
val coroutineScope = rememberCoroutineScope() | |
Column( | |
modifier = Modifier | |
.padding(contentPadding) | |
) { | |
TabRow( | |
selectedTabIndex = pagerState.currentPage, | |
indicator = { tabPositions -> |
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 TabScreen( | |
text: String, | |
) { | |
Box( | |
modifier = Modifier | |
.fillMaxSize(), | |
contentAlignment = Alignment.Center, | |
) { | |
Text( |
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
androidx.compose.material3.BottomAppBar( | |
containerColor = MaterialTheme.colors.primary, | |
actions = { | |
IconButton(onClick = { /* Check onClick */ }) { | |
Icon(Icons.Filled.Check, contentDescription = "", tint = Color.White) | |
} | |
IconButton(onClick = { /* Edit onClick */ }) { | |
Icon( | |
Icons.Filled.Edit, contentDescription = "", tint = Color.White) | |
} |
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
//Instead of backStackEntry | |
var selectedItem by remember { mutableStateOf(0) } | |
//Replace bottomNavItems.forEach with, | |
bottomNavItems.forEachIndexed { index, item -> | |
NavigationBarItem( | |
selected = selectedItem == index, | |
onClick = { | |
selectedItem = index | |
navController.navigate(item.route) |
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
// NavController is passed via parameter | |
val backStackEntry = navController.currentBackStackEntryAsState() | |
Scaffold( | |
bottomBar = { | |
androidx.compose.material3.NavigationBar( | |
containerColor = MaterialTheme.colors.primary, | |
) { | |
bottomNavItems.forEach { item -> | |
val selected = item.route == backStackEntry.value?.destination?.route |
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
Surface( | |
modifier = Modifier | |
.fillMaxWidth() | |
.height(56.dp), | |
) { | |
TextField( | |
modifier = Modifier | |
.fillMaxWidth(), | |
value = searchTextState, | |
onValueChange = { |
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
Scaffold( | |
topBar = { | |
if (searchWidgetState == SearchWidgetState.OPENED) { | |
SearchAppBar() | |
} else { | |
TopAppBar( | |
//... | |
actions = { | |
IconButton(onClick = { searchWidgetState = SearchWidgetState.OPENED }) { | |
Icon( |