This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Composable | |
| fun HomeScreen() { | |
| var count by remember { mutableStateOf(0) } | |
| Column { | |
| Text("Count = $count") | |
| Button(onClick = { count++ }){ | |
| Text("Click On Increment") | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| viewModel.userData.observe(viewLifecycleOwner){ user -> | |
| binding.userName.text = user.name | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| viewModel.userData.observe(this){ user -> | |
| binding.userName.text = user.name | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| viewModel.userData.observe(??..) { user -> | |
| binding.name.text = user.name | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class MainActivity : ComponentActivity() { | |
| override fun onCreate(savedInstanceState: Bundle?) { | |
| super.onCreate(savedInstanceState) | |
| enableEdgeToEdge() | |
| setContent { | |
| ComposeBottomNavigationTheme { | |
| Scaffold(modifier = Modifier.fillMaxSize()) { innerPadding -> | |
| AppScreen(modifier = Modifier.padding(innerPadding)) | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Composable | |
| fun AppScreen(modifier: Modifier) { | |
| val navController = rememberNavController() | |
| Scaffold( | |
| bottomBar = { BottomNavigationBar(navController = navController, appItems = Destination.toList) }, | |
| content = { padding -> | |
| Box(modifier = Modifier.padding(padding)) { | |
| AppNavigation(navController = navController) | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sealed class Destination(val route: String, val icon: Int, val title: String) { | |
| data object Home : Destination( | |
| route = "home", | |
| icon = R.drawable.ic_home, | |
| title = "Home" | |
| ) | |
| data object Categories : Destination( | |
| route = "categories", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Composable | |
| fun Order(){ | |
| Column( | |
| modifier = Modifier.fillMaxSize() | |
| .wrapContentSize(Alignment.Center) | |
| ) { | |
| Text(text = "Order", | |
| fontSize = 18.sp, | |
| color = androidx.compose.ui.graphics.Color.Gray, | |
| fontWeight = androidx.compose.ui.text.font.FontWeight.Bold, |
NewerOlder