diff --git a/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/common/ExtendCompose.kt b/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/common/ExtendCompose.kt index 27e0679..0c8be14 100644 --- a/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/common/ExtendCompose.kt +++ b/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/common/ExtendCompose.kt @@ -179,6 +179,9 @@ fun LazyListState.isScrollingUp(): Boolean { @OptIn(ExperimentalMaterial3Api::class) fun SheetState.isFullyExpandedOrTargeted(forceFullExpand: Boolean = false): Boolean { val checkState = if (this.hasExpandedState) { + if (!this.hasPartiallyExpandedState) { + return false + } SheetValue.Expanded } else { if (forceFullExpand) { diff --git a/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/medium/component/CollapsingToolbar.kt b/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/medium/component/CollapsingToolbar.kt index 303d3ca..53946df 100644 --- a/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/medium/component/CollapsingToolbar.kt +++ b/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/medium/component/CollapsingToolbar.kt @@ -147,15 +147,16 @@ fun CollapsingToolbar( }, actions = { val mediumState by mediumStateFlow.collectAsStateWithLifecycle() - val isFavoriteBlocked by isFavoriteBlockedFlow.collectAsStateWithLifecycle() - val isFavorite by isFavoriteFlow.collectAsStateWithLifecycle() - var favoriteChanged by remember(isFavorite) { mutableStateOf(null) } AnimatedVisibility( visible = mediumState.isSuccess, enter = fadeIn(), exit = fadeOut() ) { + val isFavoriteBlocked by isFavoriteBlockedFlow.collectAsStateWithLifecycle() + val isFavorite by isFavoriteFlow.collectAsStateWithLifecycle() + var favoriteChanged by remember(isFavorite) { mutableStateOf(null) } + IconButton( modifier = if (isCollapsed) { Modifier diff --git a/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/medium/dialog/character/CharacterDialog.kt b/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/medium/dialog/character/CharacterDialog.kt index 8ec3844..0e3441d 100644 --- a/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/medium/dialog/character/CharacterDialog.kt +++ b/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/medium/dialog/character/CharacterDialog.kt @@ -60,9 +60,6 @@ fun CharacterDialog(component: CharacterComponent) { ) { val image by component.image.collectAsStateWithLifecycle() val state by component.state.collectAsStateWithLifecycle() - val isFavoriteBlocked by component.isFavoriteBlocked.collectAsStateWithLifecycle() - val isFavorite by component.isFavorite.collectAsStateWithLifecycle() - var favoriteChanged by remember(isFavorite) { mutableStateOf(null) } this@ModalBottomSheet.AnimatedVisibility( modifier = Modifier.align(Alignment.CenterStart), @@ -102,6 +99,10 @@ fun CharacterDialog(component: CharacterComponent) { enter = fadeIn(), exit = fadeOut() ) { + val isFavoriteBlocked by component.isFavoriteBlocked.collectAsStateWithLifecycle() + val isFavorite by component.isFavorite.collectAsStateWithLifecycle() + var favoriteChanged by remember(isFavorite) { mutableStateOf(null) } + IconButton( onClick = { favoriteChanged = !(favoriteChanged ?: isFavorite)