j

    jaqxues

    1 year ago
    Hello, So I have these simple Preference Items that are causing me some trouble. I set the Spacer with a Modifier of weigth(1f) so the Title (or generally content) of the Preference is always on the left side and the Switch always on the right. However, when I try to use a longer text as description, the Switch gets moved and it does not look correct anymore. I tried setting a padding explicitly and other stuff, which did not work as expected.
    gsala

    gsala

    1 year ago
    I would try to put the weight modifier on the Column and remove the Spacer
    j

    jaqxues

    1 year ago
    @Composable fun SplitCard(
        modifier: Modifier = Modifier,
        left: @Composable -> Unit,
        right: @Composable -> Unit
    ) { ... }
    This is the function I made out of it. How can I make it behave like
    Modifier.weight(1f)
    for left? Wrapping it around another composable? What Composable should I use?
    Surface
    adds a background color, so that is out. This is the implementation I have. How can I apply the Modifier to left? Can I wrap it in a
    gsala

    gsala

    1 year ago
    I tried this
    j

    jaqxues

    1 year ago
    ,,, yes, but the column itself is the
    left
    parameter, cant modify its Modifier
    This is the code, how can i move the Modifier.weight out of the usage and put it in the "base" Composables.
    gsala

    gsala

    1 year ago
    Not sure what the best pattern is in this case. You could always wrap the
    left()
    with
    Box(modifier = Modifier.weight(1f) { left() }
    j

    jaqxues

    1 year ago
    yeah well guess ill end up with that