Creating a new Compose-based screen
Real-world applications are required to display a lot of content, so one screen probably won't suffice. So far, our Restaurants application features a simple screen where all the restaurants that we receive from our remote database are displayed.
Let's practice all the skills we've learned so far by creating a new screen that will display the details of a particular restaurant. The plan is that when users press on a particular restaurant from the list inside our RestaurantsScreen()
composable screen, we should take them to a new details screen for that particular restaurant.
Yet to perform navigation between two screens, we need first to build the second screen. Unlike with the first composable screen, it's time to change our tactic and build it from top to bottom. Let's build this second feature first by defining the network request, then executing it inside its own ViewModel
, and finally creating the composable UI...