Dialogs: Animating dialog size whenever content size changes(either LazyColumn's items or customContent) (v1.0.1)

This commit is contained in:
acclorite 2024-05-17 18:17:08 +03:00
parent 124351bf7f
commit 62eeca017f
2 changed files with 13 additions and 1 deletions

View file

@ -1,5 +1,8 @@
package ua.acclorite.book_story.presentation.components.custom_dialog
import androidx.compose.animation.animateContentSize
import androidx.compose.animation.core.Spring
import androidx.compose.animation.core.spring
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.ColumnScope
@ -90,6 +93,7 @@ fun CustomDialogWithContent(
.statusBarsPadding()
.clip(MaterialTheme.shapes.extraLarge)
.background(MaterialTheme.colorScheme.surfaceContainerHigh)
.animateContentSize(animationSpec = spring(stiffness = Spring.StiffnessMediumLow))
.padding(top = 24.dp, bottom = 12.dp)
) {
if (drawableIcon != null) {

View file

@ -1,5 +1,8 @@
package ua.acclorite.book_story.presentation.components.custom_dialog
import androidx.compose.animation.animateContentSize
import androidx.compose.animation.core.Spring
import androidx.compose.animation.core.spring
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
@ -91,6 +94,7 @@ fun CustomDialogWithLazyColumn(
.statusBarsPadding()
.clip(MaterialTheme.shapes.extraLarge)
.background(MaterialTheme.colorScheme.surfaceContainerHigh)
.animateContentSize(animationSpec = spring(stiffness = Spring.StiffnessMediumLow))
.padding(top = 24.dp, bottom = 12.dp)
) {
if (drawableIcon != null) {
@ -155,7 +159,11 @@ fun CustomDialogWithLazyColumn(
items()
item {
Column(modifier = Modifier.fillMaxWidth()) {
Column(
modifier = Modifier
.animateItem()
.fillMaxWidth()
) {
Spacer(modifier = Modifier.height(16.dp))
Row(
modifier = Modifier