Possible fix for nested scrolling

This commit is contained in:
Sad Ellie 2022-06-19 17:17:49 +03:00
parent d0f122497b
commit c9ef384d14
3 changed files with 43 additions and 49 deletions

View File

@ -85,9 +85,9 @@ fun AboutScreen(
},
) { padding ->
LazyColumn(
Modifier.padding(padding).padding(horizontal = 16.dp),
Modifier.padding(horizontal = 16.dp),
verticalArrangement = Arrangement.spacedBy(16.dp),
contentPadding = PaddingValues(vertical = 16.dp)
contentPadding = padding
) {
items(items = ALL_LIBRARIES.value) {
OutlinedCard(

View File

@ -78,51 +78,49 @@ private fun BasicUnitListScreen(
Scaffold(
modifier = Modifier.nestedScroll(scrollBehavior.nestedScrollConnection),
topBar = {
Column {
SearchBar(
title = title,
value = uiState.searchQuery,
onValueChange = {
viewModel.onSearchQueryChange(it)
viewModel.loadUnitsToShow(noBrokenCurrencies)
},
favoritesOnly = uiState.favoritesOnly,
favoriteAction = {
viewModel.toggleFavoritesOnly()
viewModel.loadUnitsToShow(noBrokenCurrencies)
},
navigateUpAction = navigateUp,
focusManager = focusManager,
scrollBehavior = scrollBehavior
)
chipsRow(
uiState.chosenUnitGroup,
{
viewModel.toggleSelectedChip(it)
viewModel.loadUnitsToShow(noBrokenCurrencies)
},
chipsRowLazyListState
)
}
SearchBar(
title = title,
value = uiState.searchQuery,
onValueChange = {
viewModel.onSearchQueryChange(it)
viewModel.loadUnitsToShow(noBrokenCurrencies)
},
favoritesOnly = uiState.favoritesOnly,
favoriteAction = {
viewModel.toggleFavoritesOnly()
viewModel.loadUnitsToShow(noBrokenCurrencies)
},
navigateUpAction = navigateUp,
focusManager = focusManager,
scrollBehavior = scrollBehavior
)
}
) { paddingValues ->
LazyColumn(
modifier = Modifier.padding(paddingValues)
Column(
Modifier.padding(paddingValues)
) {
if (uiState.unitsToShow.isEmpty()) {
item { SearchPlaceholder() }
return@LazyColumn
}
uiState.unitsToShow.forEach { (unitGroup, listOfUnits) ->
stickyHeader { Header(text = stringResource(id = unitGroup.res)) }
items(items = listOfUnits, key = { it.unitId }) { unit ->
unitsListItem(
unit
) {
selectAction(it)
viewModel.onSearchQueryChange("")
focusManager.clearFocus(true)
navigateUp()
chipsRow(
uiState.chosenUnitGroup,
{
viewModel.toggleSelectedChip(it)
viewModel.loadUnitsToShow(noBrokenCurrencies)
},
chipsRowLazyListState
)
LazyColumn {
if (uiState.unitsToShow.isEmpty()) {
item { SearchPlaceholder() }
return@LazyColumn
}
uiState.unitsToShow.forEach { (unitGroup, listOfUnits) ->
stickyHeader { Header(text = stringResource(id = unitGroup.res)) }
items(items = listOfUnits, key = { it.unitId }) { unit ->
unitsListItem(unit) {
selectAction(it)
viewModel.onSearchQueryChange("")
focusManager.clearFocus(true)
navigateUp()
}
}
}
}

View File

@ -88,11 +88,7 @@ fun SettingsScreen(
)
},
content = { padding ->
LazyColumn(
Modifier
.padding(padding)
.fillMaxHeight()
) {
LazyColumn(contentPadding = padding) {
item {
Column {
// Group header