Hi I don't know how can I call "weight(1f)" in my another comopose funtion
Error gives me
Expression weight cannot be invoke as a function. The funtcion invokle is not found
FoodMenu
@Composable
fun FoodMenu(modifier: Modifier = Modifier)
{
Row (modifier=Modifier.fillMaxWidth()
.wrapContentSize()
)
{
FoodItem()
}
}
FoodItem
@Composable
fun FoodItem(modifier: Modifier = Modifier)
{
Box(modifier = Modifier.weight(1f))
{
Text(text= "Salad")
}
Box(modifier = Modifier.weight(1f))
{
Text(text= "Salad")
}
}
Any help please,.thanks so much
CodePudding user response:
I put Rowscope and it work
@Composable
fun RowScope.FoodItem(modifier: Modifier = Modifier)
{
Box(
modifier = Modifier.weight(1f)) {
Text(text= "Salad")
}
Box(modifier = Modifier.weight(1f))
{
Text(text= "Fries")
}