jamshedalamqaderi
09/27/2023, 5:58 AMModifier.exposedDropdownSize()
not working. Please see the code in threadjamshedalamqaderi
09/27/2023, 5:58 AMval expanded = remember { mutableStateOf(false) }
ExposedDropdownMenuBox(
expanded.value,
onExpandedChange = {
expanded.value = !expanded.value
},
) {
OutlinedTextField(
"Hello",
onValueChange = {},
readOnly = true,
modifier = Modifier.menuAnchor().fillMaxWidth(),
textStyle = TextStyle(
color = White,
fontSize = 14.sp,
fontFamily = PretendardSemiBold(),
lineHeight = 21.sp,
),
trailingIcon = {
val rotation by animateFloatAsState(if (expanded.value) 180F else 0F)
Icon(
rememberVectorPainter(Icons.Default.KeyboardArrowDown),
contentDescription = null,
modifier = Modifier.size(20.dp).rotate(rotation),
tint = White
)
},
shape = RoundedCornerShape(5.dp),
colors = ExposedDropdownMenuDefaults.outlinedTextFieldColors(
unfocusedBorderColor = White.copy(0.5f),
disabledBorderColor = White.copy(0.5f),
focusedBorderColor = White.copy(0.5f)
)
)
ExposedDropdownMenu(
expanded.value,
onDismissRequest = { expanded.value = false },
modifier = Modifier
.background(BackgroundColor)
.exposedDropdownSize()
) {
DropdownMenuItem(
text = {
Text(
"Hello", style = TextStyle(
color = White,
fontSize = 14.sp,
fontFamily = PretendardSemiBold(),
lineHeight = 21.sp,
)
)
},
onClick = {},
modifier = Modifier.fillMaxWidth()
)
}
}