Animate room list filters when clearing
They animate cleanly back to their original locations now, and correctly overlap each other when doing so. The only thing that is mildly jarring is the reappearing chips, but there's no way to animate appearance in the current version of jetpack compose, so that'll have to be fixed later. Signed-off-by: Joe Groocock <me@frebib.net>
This commit is contained in:
@@ -34,7 +34,6 @@ import androidx.compose.foundation.shape.CircleShape
|
||||
import androidx.compose.material3.FilterChip
|
||||
import androidx.compose.material3.FilterChipDefaults
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Alignment
|
||||
@@ -106,13 +105,6 @@ fun RoomListFiltersView(
|
||||
}
|
||||
}
|
||||
}
|
||||
LaunchedEffect(state.filterSelectionStates) {
|
||||
// Checking for canScrollBackward is necessary for the itemPlacementAnimation to work correctly.
|
||||
// We don't want the itemPlacementAnimation to be triggered when clearing the filters.
|
||||
if (!state.hasAnyFilterSelected || lazyListState.canScrollBackward) {
|
||||
lazyListState.animateScrollToItem(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
|
||||
Reference in New Issue
Block a user