val textStyleBody1 = TextStyle(
color = HaiveColor_Main,
fontSize = 18.sp,
fontWeight = FontWeight.SemiBold
)
//文本自动缩小
var textStyle1 by remember { mutableStateOf(textStyleBody1) }
var readyToDraw1 by remember { mutableStateOf(false) }
val textStyleBody2 = TextStyle(
color = HaiveColor_Main,
fontSize = 18.sp,
fontWeight = FontWeight.SemiBold
)
Text(
text = "${mMonthPrice}/${stringResource(id = R.string.pop_vip_label_mo)}",
color= HaiveColor_White,
textStyle = textStyle1,
modifier = Modifier.drawWithContent {
if (readyToDraw1) drawContent()
},
//自动变小
onTextLayout = { textLayoutResult ->
if (textLayoutResult.didOverflowWidth) {
textStyle1 =
textStyle1.copy(fontSize = textStyle1.fontSize * 0.9)
} else {
readyToDraw1 = true
}
},
)