Skip to content

Commit

Permalink
Merge pull request #26 from Steyrix/feature/fix_over_expansion
Browse files Browse the repository at this point in the history
Main screen: fix case, when input view expansion was excessive
  • Loading branch information
vamelchenia authored Nov 2, 2023
2 parents 744fd87 + ca28aa3 commit 4c2fd72
Showing 1 changed file with 7 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.example.mainscreen.composables

import androidx.compose.foundation.background
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.interaction.PressInteraction
import androidx.compose.foundation.interaction.collectIsPressedAsState
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxSize
Expand All @@ -20,7 +20,6 @@ import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.material3.TextFieldDefaults
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
Expand Down Expand Up @@ -58,19 +57,13 @@ fun InputView(
) {
var textFieldValue by remember { mutableStateOf(TextFieldValue("")) }
val interactionSource = remember { MutableInteractionSource() }
.also { source ->
LaunchedEffect(source) {
source.interactions.collect {
when (it) {
is PressInteraction.Release -> {
if (!state.isFocused) {
inputAreaOnClick()
}
}
}
}
}

if (interactionSource.collectIsPressedAsState().value) {
if (!state.isFocused) {
inputAreaOnClick()
}
}

val shape = RoundedCornerShape(roundingSize, roundingSize, 0.dp, 0.dp)

ConstraintLayout(
Expand Down

0 comments on commit 4c2fd72

Please sign in to comment.