Fix height shift when scrolling through themes

This commit is contained in:
arkon 2023-02-21 11:50:15 -05:00
parent 6b03dca5f4
commit 0bd56ab77c

View file

@ -1,6 +1,5 @@
package eu.kanade.presentation.more.settings.widget package eu.kanade.presentation.more.settings.widget
import androidx.compose.animation.animateContentSize
import androidx.compose.foundation.background import androidx.compose.foundation.background
import androidx.compose.foundation.border import androidx.compose.foundation.border
import androidx.compose.foundation.clickable import androidx.compose.foundation.clickable
@ -9,6 +8,7 @@ import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.aspectRatio import androidx.compose.foundation.layout.aspectRatio
import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
@ -79,9 +79,6 @@ private fun AppThemesList(
.filterNot { it.titleResId == null || (it == AppTheme.MONET && !DeviceUtil.isDynamicColorAvailable) } .filterNot { it.titleResId == null || (it == AppTheme.MONET && !DeviceUtil.isDynamicColorAvailable) }
} }
LazyRow( LazyRow(
modifier = Modifier
.animateContentSize()
.padding(vertical = MaterialTheme.padding.small),
contentPadding = PaddingValues(horizontal = PrefsHorizontalPadding), contentPadding = PaddingValues(horizontal = PrefsHorizontalPadding),
horizontalArrangement = Arrangement.spacedBy(MaterialTheme.padding.small), horizontalArrangement = Arrangement.spacedBy(MaterialTheme.padding.small),
) { ) {
@ -104,14 +101,16 @@ private fun AppThemesList(
) )
} }
Spacer(modifier = Modifier.height(8.dp))
Text( Text(
text = stringResource(appTheme.titleResId!!), text = stringResource(appTheme.titleResId!!),
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
.padding(top = 8.dp)
.secondaryItemAlpha(), .secondaryItemAlpha(),
textAlign = TextAlign.Center, textAlign = TextAlign.Center,
maxLines = 2, maxLines = 2,
minLines = 2,
style = MaterialTheme.typography.bodyMedium, style = MaterialTheme.typography.bodyMedium,
) )
} }