Move AlertDialogState to parameters of ColorPicker

This commit is contained in:
Ensar Sarajčić 2023-10-05 13:08:25 +02:00
parent acc8500bd2
commit 21a6196896

View File

@ -57,7 +57,7 @@ class BrightDisplayActivity : ComponentActivity() {
setContent { setContent {
AppThemeSurface { AppThemeSurface {
val colorPickerDialogState = rememberAlertDialogState().apply { val colorPickerDialogState = rememberAlertDialogState().apply {
ColorPicker() ColorPicker(this)
} }
ScreenContent(colorPickerDialogState::show) ScreenContent(colorPickerDialogState::show)
@ -70,11 +70,13 @@ class BrightDisplayActivity : ComponentActivity() {
} }
@Composable @Composable
private fun AlertDialogState.ColorPicker() { private fun ColorPicker(
alertDialogState: AlertDialogState
) {
val brightDisplayColor by preferences.brightDisplayColorFlow.collectAsStateWithLifecycle(preferences.brightDisplayColor) val brightDisplayColor by preferences.brightDisplayColorFlow.collectAsStateWithLifecycle(preferences.brightDisplayColor)
DialogMember { alertDialogState.DialogMember {
ColorPickerAlertDialog( ColorPickerAlertDialog(
alertDialogState = this, alertDialogState = alertDialogState,
color = brightDisplayColor, color = brightDisplayColor,
removeDimmedBackground = true, removeDimmedBackground = true,
onActiveColorChange = viewModel::updateBackgroundColor, onActiveColorChange = viewModel::updateBackgroundColor,