I want to group two related components that are pa...
# compose
k
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.
Copy code
@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
error or warning? You can just supress it
k
Yeah it was warning but I felt that warning itself is not necessary or I’d like to know why is it so?
c
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
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
.
a
Which part of
ConstrainedLayoutReferences
isn't public?