Jetbrains Ttvna
07/26/2023, 4:44 PMJetbrains Ttvna
07/26/2023, 4:44 PMScaffold(
topBar = {
TopAppBar(
title = { Text(text = "Overload")},
colors = TopAppBarDefaults.topAppBarColors (
containerColor = MaterialTheme.colorScheme.onPrimaryContainer,
titleContentColor = MaterialTheme.colorScheme.primaryContainer
)
)
}
) { paddingValues ->
Box(modifier = Modifier.fillMaxSize()) {
Column(modifier = Modifier.padding(paddingValues)) {
TabRow(
selectedTabIndex = pagerState.currentPage,
indicator = { tabPositions ->
if (pagerState.currentPage < tabPositions.size) {
TabRowDefaults.PrimaryIndicator(
modifier = Modifier
.tabIndicatorOffset(tabPositions[pagerState.currentPage]),
shape = RoundedCornerShape(
topStart = 3.dp,
topEnd = 3.dp,
bottomEnd = 0.dp,
bottomStart = 0.dp,
),
)
}
},
) {
homeTabItems.forEachIndexed { index, item ->
Tab(
selected = pagerState.currentPage == index,
onClick = { coroutineScope.launch { pagerState.animateScrollToPage(index) } },
text = {
Text(
text = item.title,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
color = MaterialTheme.colorScheme.onSurface,
)
}
)
}
}
HorizontalPager(
state = pagerState,
){
homeTabItems[pagerState.currentPage].screen()
}
}
BoxWithConstraints(modifier = Modifier.fillMaxSize()) {
FloatingActionButton(
onClick = { /*TODO*/ },
modifier = Modifier
.align(Alignment.BottomEnd)
.padding(16.dp),
containerColor = MaterialTheme.colorScheme.tertiaryContainer,
contentColor = MaterialTheme.colorScheme.onTertiaryContainer
) {
Icon(
imageVector = Icons.Default.Edit,
contentDescription = stringResource(id = R.string.edit),
modifier = Modifier.padding(18.dp)
)
}
}
}
}
https://github.com/pabloscloud/Reply
Anybody willing to help me out? Thanks!Jetbrains Ttvna
07/26/2023, 4:44 PMJetbrains Ttvna
07/26/2023, 4:44 PMStylianos Gakis
07/26/2023, 6:07 PMStylianos Gakis
07/26/2023, 6:08 PMJetbrains Ttvna
07/26/2023, 6:20 PMWhere's the code that applies the bottom bar too?https://github.com/pabloscloud/Reply/blob/17881281eea9c1b889a923231c33469dafd3fef3[…]va/com/example/reply/ui/navigation/ReplyNavigationComponents.kt That said, if I understood you correct now, I should add the bottom bar to the scaffold instead which then detects how much padding needs to be applied
Stylianos Gakis
07/26/2023, 7:47 PMReplyNavHost
will receive bottom insets of as much as the system navigation bar is high. But in the situation where your bottom nav is showing, you don’t want that to happen, since your bottom nav is the one who’s already consuming those insets.
If in there you do what I am doing in the link I provided you, which is basically
ReplyNavHost(
navController = navController,
modifier = Modifier
.weight(1f)
.then(
if(navigationType == ReplyNavigationType.BOTTOM_NAVIGATION) {
Modifier.consumeWindowInsets(WindowInsets.systemBars.only(WindowInsetsSides.Bottom))
} else {
Modifier
}
),
)
It should be fixed for you I thinkJetbrains Ttvna
07/27/2023, 5:53 PMJetbrains Ttvna
07/27/2023, 5:53 PMJetbrains Ttvna
07/27/2023, 5:53 PMStylianos Gakis
07/27/2023, 7:42 PM