@Composable
fun SimpleFilledTextFieldSample(largeSize: Boolean) {
val size by animateDpAsState(
targetValue = if (largeSize) 50.dp else 50.dp/3.5f,
animationSpec = tween(
durationMillis = 2000,
easing = FastOutSlowInEasing
)
)
var text by remember { mutableStateOf("Hello") }
TextField(
modifier = Modifier
.size(374.dp/3.5f, size)
.background(Color.LightGray),
textStyle = LocalTextStyle.current.copy(
fontSize = 24.sp/3.5f,
color = Color.Black
),
colors = TextFieldDefaults.colors(
focusedIndicatorColor = Color.Transparent,
unfocusedIndicatorColor = Color.Transparent,
disabledIndicatorColor = Color.Transparent ,
),
shape = RoundedCornerShape(4.dp),
singleLine = true,
value = text,
onValueChange = { text = it },
placeholder = {
Text(text = "Enter your text here")
},
)
}
var largeSize by remember { mutableStateOf(true) }
Column(
modifier = Modifier
.verticalScroll(scrollState)
.fillMaxSize()
.offset(x = 20.dp)
) {
Spacer(modifier = Modifier.height(20.dp))
SimpleFilledTextFieldSample(largeSize)
Spacer(modifier = Modifier.height(2.dp))
Button(onClick = { largeSize=largeSize.not() }) {
Text(text = "111")
}
}