Skip to content

Commit

Permalink
πŸ› Fixed bug in parameter for viewmodel
Browse files Browse the repository at this point in the history
No ViewModelStoreOwner was provided via LocalViewModelStoreOwner
  • Loading branch information
lorenzovngl committed Oct 1, 2023
1 parent 4caa2fc commit 798df34
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.lifecycle.viewmodel.compose.viewModel
import com.lorenzovainigli.foodexpirationdates.model.repository.PreferencesRepository
import com.lorenzovainigli.foodexpirationdates.ui.theme.FoodExpirationDatesTheme
import com.lorenzovainigli.foodexpirationdates.viewmodel.PreferencesViewModel
Expand All @@ -25,7 +24,7 @@ fun MyTopAppBar(
actions: @Composable RowScope.() -> Unit = {},
navigationIcon: @Composable () -> Unit = {},
scrollBehavior: TopAppBarScrollBehavior? = null,
prefsViewModel: PreferencesViewModel? = viewModel()
prefsViewModel: PreferencesViewModel? = null
) {
val context = LocalContext.current
val topBarFontState = prefsViewModel?.getTopBarFont(context)?.collectAsState()?.value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ fun InfoActivityLayout(
)
}
},
scrollBehavior = scrollBehavior
scrollBehavior = scrollBehavior,
prefsViewModel = prefsViewModel
)
}
) { padding ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ fun InsertActivityLayout(
)
}
},
scrollBehavior = scrollBehavior
scrollBehavior = scrollBehavior,
prefsViewModel = prefsViewModel
)
},
floatingActionButtonPosition = FabPosition.End,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ fun MainActivityLayout(
)
}
},
scrollBehavior = scrollBehavior
scrollBehavior = scrollBehavior,
prefsViewModel = prefsViewModel
)
},
bottomBar = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ fun SettingsActivityLayout(
)
}
},
scrollBehavior = scrollBehavior
scrollBehavior = scrollBehavior,
prefsViewModel = prefsViewModel
)
}
) { padding ->
Expand Down

0 comments on commit 798df34

Please sign in to comment.