k

    Kshitij Patil

    1 year ago
    I want to group two related components that are part of ConstraintLayout to a separate
    @Composable
    function. Currently I was planning to borrow the constraints from parent layout through
    Modifier
    type parameter.
    @Composable
    fun CustomGroup(
        <required-fields>,
        ...,
        firstComponentModifier: Modifier = Modifier,
        secondComponentModifier: Modifier = Modifier,
        ...,
        <other optional fields>
    ) { ... }
    This seems to be working for me but the linter gives this error warning: “Modifier parameter should be named modifier”. I think my use-case is valid and we shouldn’t restrict modifier name to be modifier only or we should make
    ConstrainedLayoutReferences
    class public so that I could pass it on as parameter to other function
    a

    allan.conda

    1 year ago
    error or warning? You can just supress it
    k

    Kshitij Patil

    1 year ago
    Yeah it was warning but I felt that warning itself is not necessary or I’d like to know why is it so?
    Cyril Find

    Cyril Find

    1 year ago
    We might be missing some context here but I think it’s more “compose” to pass both your Composables as parameters instead of the modifiers
    f

    fmasa

    1 year ago
    Well, even Compose itself uses multiple modifiers on some places. I think it's completely fine to suppress the warning just like in i.e.
    DropdowMenu
    .
    Adam Powell

    Adam Powell

    1 year ago
    Which part of
    ConstrainedLayoutReferences
    isn't public?