Сделал красивую анимацию буковок

This commit is contained in:
Кашин Максим 2023-10-28 01:09:25 +04:00
parent 55aeb5f83a
commit 4cdd07220a

View File

@ -1,6 +1,7 @@
package com.example.labwork.pages
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.core.animateDpAsState
import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.animation.expandIn
import androidx.compose.animation.fadeIn
@ -10,7 +11,6 @@ import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
@ -20,9 +20,9 @@ import androidx.compose.material.ButtonDefaults
import androidx.compose.material.Card
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
@ -43,6 +43,7 @@ import com.example.labwork.ui.theme.LightBluePolitech
fun ListProduct(item: ItemProduct) {
var isFullAbout by remember { mutableStateOf(false) }
val scale by animateFloatAsState(if (isFullAbout) 1f else 0f)
val textSize by animateDpAsState(if (isFullAbout) 18.dp else 24.dp)
Card(
modifier = Modifier
@ -76,15 +77,16 @@ fun ListProduct(item: ItemProduct) {
Text(
text = "Подробнее",
color = Color.White,
modifier = Modifier.fillMaxSize(),
fontSize = 10.sp,
textAlign = TextAlign.Center,
)
}
}
Column {
Text(text = item.name,
Text(
text = item.name,
color = Color.Black,
fontSize = if (isFullAbout) 18.sp else 24.sp,
fontSize = textSize.value.sp,
fontWeight = FontWeight.Bold,
textAlign = TextAlign.Center,
modifier = Modifier.fillMaxWidth().padding(top = 8.dp)
@ -108,4 +110,4 @@ fun ListProduct(item: ItemProduct) {
}
}
}
}
}