Skip to content

Commit

Permalink
#7 - Consuming a Flow from the ViewModel
Browse files Browse the repository at this point in the history
  • Loading branch information
jhg3410 committed Feb 19, 2023
1 parent 8a77530 commit e106fba
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@ import androidx.compose.material.ExperimentalMaterialApi
import androidx.compose.material.Scaffold
import androidx.compose.material.rememberBackdropScaffoldState
import androidx.compose.material.rememberScaffoldState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.runtime.*
import androidx.compose.samples.crane.base.CraneDrawer
import androidx.compose.samples.crane.base.CraneTabBar
import androidx.compose.samples.crane.base.CraneTabs
Expand Down Expand Up @@ -77,7 +73,7 @@ fun CraneHomeContent(
viewModel: MainViewModel = viewModel(),
) {
// TODO Codelab: collectAsState step - consume stream of data from the ViewModel
val suggestedDestinations: List<ExploreModel> = remember { emptyList() }
val suggestedDestinations by viewModel.suggestedDestinations.collectAsState()

val onPeopleChanged: (Int) -> Unit = { viewModel.updatePeople(it) }
var tabSelected by remember { mutableStateOf(CraneScreen.Fly) }
Expand Down

0 comments on commit e106fba

Please sign in to comment.