Alejandro Rios
07/08/2020, 1:55 AM@Composable
@Preview(showBackground = true)
fun DefaultRecipeCard() {
Scaffold(topAppBar = {
TopAppBar(
title = {
Text(text = "ComposablecookBok")
}
)
}, bodyContent = {
RecipeList(defaultRecipes)
}, bottomAppBar = BottomAppBar {
Text(
text = "Jetpack Compose",
modifier = Modifier.padding(16.dp)
)
}
)
}
nglauber
07/08/2020, 4:15 AMbottomBar = {
BottomAppBar(content = {
BottomNavigationItem(
icon = {
Icon(Icons.Default.Person)
},
selected = bottomBarSelectedIndex == 0,
onSelected = { bottomBarSelectedIndex = 0 },
activeColor = Color.Magenta,
inactiveColor = Color.LightGray
)
BottomNavigationItem(
icon = {
Icon(Icons.Default.Favorite)
},
selected = bottomBarSelectedIndex == 1,
onSelected = { bottomBarSelectedIndex = 1 },
activeColor = Color.Magenta,
inactiveColor = Color.LightGray
)
BottomNavigationItem(
icon = {
Icon(Icons.Default.Settings)
},
selected = bottomBarSelectedIndex == 2,
onSelected = { bottomBarSelectedIndex = 2 },
activeColor = Color.Magenta,
inactiveColor = Color.LightGray
)
})
},
nglauber
07/08/2020, 4:16 AMbottomBarSelectedStateIndex
var bottomBarSelectedIndex by state { 0 }
Timo Drick
07/08/2020, 8:32 AMmatvei
07/08/2020, 8:59 AMbottomAppBar = BottomAppBar {
Text(
text = "Jetpack Compose",
modifier = Modifier.padding(16.dp)
)
}
should become
bottomAppBar = {
BottomAppBar {
Text(
text = "Jetpack Compose",
modifier = Modifier.padding(16.dp)
)
}
}
Haha, just saw that Adam answered below, nvm %)Alejandro Rios
07/12/2020, 5:51 PM