Fix Overlay clickable.
This commit is contained in:
parent
59d84963a9
commit
f3b11e30c5
3 changed files with 12 additions and 7 deletions
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
|
|
@ -119,6 +119,8 @@
|
||||||
<entry key="../../../../../layout/compose-model-1620499743476.xml" value="0.5818181818181818" />
|
<entry key="../../../../../layout/compose-model-1620499743476.xml" value="0.5818181818181818" />
|
||||||
<entry key="../../../../../layout/compose-model-1620500516060.xml" value="0.5818181818181818" />
|
<entry key="../../../../../layout/compose-model-1620500516060.xml" value="0.5818181818181818" />
|
||||||
<entry key="../../../../../layout/compose-model-1620500563383.xml" value="0.5818181818181818" />
|
<entry key="../../../../../layout/compose-model-1620500563383.xml" value="0.5818181818181818" />
|
||||||
|
<entry key="../../../../../layout/compose-model-1620500952241.xml" value="0.5818181818181818" />
|
||||||
|
<entry key="../../../../../layout/compose-model-1620501296868.xml" value="0.1" />
|
||||||
<entry key="app/src/main/res/drawable-v24/ic_launcher_foreground.xml" value="0.2898148148148148" />
|
<entry key="app/src/main/res/drawable-v24/ic_launcher_foreground.xml" value="0.2898148148148148" />
|
||||||
<entry key="app/src/main/res/drawable/ic_baseline_local_library_24.xml" value="0.25462962962962965" />
|
<entry key="app/src/main/res/drawable/ic_baseline_local_library_24.xml" value="0.25462962962962965" />
|
||||||
<entry key="app/src/main/res/drawable/ic_google.xml" value="0.2962962962962963" />
|
<entry key="app/src/main/res/drawable/ic_google.xml" value="0.2962962962962963" />
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
package com.pixelized.biblib.ui.composable.items.dialog
|
package com.pixelized.biblib.ui.composable.items.dialog
|
||||||
|
|
||||||
import androidx.compose.animation.Crossfade
|
import androidx.compose.animation.Crossfade
|
||||||
|
import androidx.compose.animation.core.tween
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
import androidx.compose.foundation.clickable
|
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.BoxScope
|
import androidx.compose.foundation.layout.BoxScope
|
||||||
import androidx.compose.foundation.layout.fillMaxHeight
|
import androidx.compose.foundation.layout.fillMaxHeight
|
||||||
|
|
@ -14,16 +14,16 @@ import androidx.compose.ui.graphics.Color
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun CrossFadeOverlay(
|
fun CrossFadeOverlay(
|
||||||
|
modifier: Modifier = Modifier,
|
||||||
visible: Boolean,
|
visible: Boolean,
|
||||||
content: @Composable BoxScope.() -> Unit
|
content: @Composable BoxScope.() -> Unit
|
||||||
) {
|
) {
|
||||||
Crossfade(targetState = visible) {
|
Crossfade(targetState = visible, animationSpec = tween(500)) {
|
||||||
if (it) {
|
if (it) {
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier
|
modifier = modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.fillMaxHeight()
|
.fillMaxHeight()
|
||||||
.clickable { }
|
|
||||||
) {
|
) {
|
||||||
// Transparent background.
|
// Transparent background.
|
||||||
Box(
|
Box(
|
||||||
|
|
|
||||||
|
|
@ -151,13 +151,16 @@ private fun LoginScreenDialogComposable(
|
||||||
) {
|
) {
|
||||||
val state = authentication.state.observeAsState()
|
val state = authentication.state.observeAsState()
|
||||||
CrossFadeOverlay(
|
CrossFadeOverlay(
|
||||||
|
modifier = Modifier.clickable {
|
||||||
|
if (state.value is IAuthentication.State.Error) {
|
||||||
|
authentication.clearState()
|
||||||
|
}
|
||||||
|
},
|
||||||
visible = (state.value is IAuthentication.State.Initial).not()
|
visible = (state.value is IAuthentication.State.Initial).not()
|
||||||
) {
|
) {
|
||||||
when (val currentState = state.value) {
|
when (val currentState = state.value) {
|
||||||
is IAuthentication.State.Error -> ErrorCard(
|
is IAuthentication.State.Error -> ErrorCard(
|
||||||
modifier = Modifier
|
modifier = Modifier.align(Alignment.Center),
|
||||||
.align(Alignment.Center)
|
|
||||||
.clickable { authentication.clearState() },
|
|
||||||
message = stringResource(id = R.string.error_generic),
|
message = stringResource(id = R.string.error_generic),
|
||||||
exception = currentState.exception
|
exception = currentState.exception
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue