Thread
#compose
    j

    Joseph D

    1 year ago
    I've seen there's no API for reading for example a Modifier's size, what's the reason behind that? Let's say I need to read it because some other value depends on it.
    Adam Powell

    Adam Powell

    1 year ago
    There is
    Modifier.onSizeChanged
    but you should use caution not to create circular data dependencies based on it. Acting on an output of layout (such as element size) during composition should always make you think twice.
    j

    Joseph D

    1 year ago
    I see. So I guess that basing a Text's fontSize on the Modifier's size is wrong. What would be instead the right approach? Or maybe there's a way to automatically have the fontSize dependant of the size?
    Adam Powell

    Adam Powell

    1 year ago
    I think @cb might have done some work with this use case, cc @Siyamed too
    j

    Joseph D

    1 year ago
    This solution seems to fit my case yet it would be nice an OOTB solution
    Siyamed

    Siyamed

    1 year ago
    Joseph are you trying to implement autosize?
    j

    Joseph D

    1 year ago
    I am, Siyamed
    Siyamed

    Siyamed

    1 year ago
    Implementing a composable with layout and using paragraph to fit into the size given sounds like a solution to me to make things in one pass.
    Shakil Karim

    Shakil Karim

    1 year ago
    @Siyamed is there any example code for AutoTextSize based on what your are describing here ?