Kshitij Patil
11/11/2020, 4:17 PMLouis Pullen-Freilich [G]
11/11/2020, 5:11 PMModifier.weight()
, that's all BottomNavigationItem
does.Kshitij Patil
11/11/2020, 5:35 PMBottonNavigationItem
Box(
with(ColumnScope) {
modifier
.selectable(
selected = selected,
onClick = onClick,
interactionState = interactionState,
indication = ripple
)
.weight(1f)
},
alignment = Alignment.Center
) {...}
Have tried it with both ColumnScope
and RowScope
, nothing changes.Louis Pullen-Freilich [G]
11/11/2020, 6:32 PMBox
directly inside a Column
though?
In any case this pattern is not recommended, and if you want your navigation items to only be used inside a column, you should define them as:
@Composable
fun ColumnScope.BottomNavigationItem(...) {}
So that way they can only be used inside a Column
,and you know that the Modifier.weight
will work correctlyKshitij Patil
11/11/2020, 6:47 PMLouis Pullen-Freilich [G]
11/11/2020, 6:51 PMwith(ColumnScope)
and make :
@Composable
fun NavigationRailItem
become
@Composable
fun ColumnScope.NavigationRailItem
Kshitij Patil
11/11/2020, 7:06 PMLouis Pullen-Freilich [G]
11/11/2020, 7:07 PMModifier.weight
then 🙂Kshitij Patil
11/11/2020, 7:10 PMModifier.wrapContentHeight(<http://Alignment.Top|Alignment.Top>)
didn't work.
Also, when I remove the weight
, the entire navRail
is occupied by only one navigation itemLouis Pullen-Freilich [G]
11/11/2020, 7:29 PMKshitij Patil
11/11/2020, 8:13 PMMihai Popa
11/12/2020, 2:00 PMverticalArrangement
on Column
to define the vertical positioning of the elementsweight
hereKshitij Patil
11/12/2020, 2:01 PMweight
whole column is occupied by just one elementMihai Popa
11/12/2020, 2:01 PMweight
will cause the first element to get all the height is simply because you size your custom MockItem
layout to fill the available heightlayout(constraints.maxWidth,constraints.maxHeight)
layout(constraints.maxWidth, placeable.height)
instead?Kshitij Patil
11/12/2020, 2:04 PMMihai Popa
11/12/2020, 2:05 PMI'll try use sum of heights of both themRight (consider you might also want padding between them)
Kshitij Patil
11/12/2020, 2:11 PMMihai Popa
11/12/2020, 2:12 PMKshitij Patil
11/12/2020, 2:34 PMconstraints.maxHeight
I set the
height=iconPlaceable.height+labelPlaceable.height+(2*baselineOffset)
and started placing Placeable
s from y=0