zt
04/13/2023, 5:27 AMIconButton(onClick = onClickFullscreen) {
if (isFullscreen) {
Icon(
imageVector = Icons.Default.FullscreenExit,
contentDescription = stringResource(R.string.close_fullscreen)
)
} else {
Icon(
imageVector = Icons.Default.Fullscreen,
contentDescription = stringResource(R.string.open_fullscreen)
)
}
}FunkyMuse
04/13/2023, 5:34 AMzt
04/13/2023, 5:41 AMFrancesc
04/13/2023, 11:05 PMif and else they have separate states and the state is lost when switching from the if to the else or vice versa (though you can save it with rememberSaveable).
But the main difference is that, with moveableContentOf you can have the 2 composables be the same and have the same state when moving from one location to another.zt
04/13/2023, 11:06 PMFrancesc
04/13/2023, 11:06 PMmoveableContentOf thoughzt
04/13/2023, 11:07 PMFrancesc
04/13/2023, 11:08 PMFrancesc
04/13/2023, 11:08 PMzt
04/13/2023, 11:08 PMzt
04/13/2023, 11:08 PM