Dovydas
03/31/2025, 4:55 PMTextAutoSizeLayoutScope
the function performLayout
will ignore the string specified to it to lay out and will always use the one of the TextField
to which this TextAutoSize
was added.
val text1 = AnnotatedString("labas")
val layoutResult = performLayout(constraints, text1, currentPx.toSp())
println(layoutResult) // TextLayoutResult(layoutInput=TextLayoutInput(text=Timetable...
Zach Klippenstein (he/him) [MOD]
03/31/2025, 5:13 PMperformLayout
shouldn't have that parameter at all.Dovydas
03/31/2025, 5:14 PMZach Klippenstein (he/him) [MOD]
03/31/2025, 5:14 PMHalil Ozercan
03/31/2025, 5:16 PMHalil Ozercan
03/31/2025, 5:16 PMtext
parameter surprised me as wellDovydas
03/31/2025, 5:17 PMDovydas
03/31/2025, 5:36 PMDovydas
03/31/2025, 10:50 PMconstraints
passed to the performLayout
function are also completely ignored. So this function only looks at parameters from the main getFontSize
function:
override fun TextAutoSizeLayoutScope.getFontSize(
constraints: Constraints,
text: AnnotatedString
): TextUnit
getFontSize
will also always return whatever fontsize was last used in the performLayout
function:
performLayout(constraints, text, 45.sp)
return 0.sp // In the end, getFontSize will still return 45.sp