Skip to content

Commit a969041

Browse files
committed
Fix min edit text size for 6 digits long text
1 parent af3693a commit a969041

File tree

1 file changed

+9
-0
lines changed
  • library-compose/src/main/java/com/spendesk/grapes/compose/edittext/windowed

1 file changed

+9
-0
lines changed

library-compose/src/main/java/com/spendesk/grapes/compose/edittext/windowed/WindowEditText.kt

+9
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@ import androidx.compose.foundation.background
44
import androidx.compose.foundation.layout.Arrangement
55
import androidx.compose.foundation.layout.Box
66
import androidx.compose.foundation.layout.Column
7+
import androidx.compose.foundation.layout.IntrinsicSize
78
import androidx.compose.foundation.layout.Spacer
89
import androidx.compose.foundation.layout.fillMaxSize
910
import androidx.compose.foundation.layout.fillMaxWidth
1011
import androidx.compose.foundation.layout.padding
1112
import androidx.compose.foundation.layout.size
13+
import androidx.compose.foundation.layout.width
1214
import androidx.compose.foundation.shape.RoundedCornerShape
1315
import androidx.compose.foundation.text.BasicTextField
1416
import androidx.compose.foundation.text.KeyboardOptions
@@ -99,6 +101,7 @@ internal fun WindowEditTextBase(
99101

100102
Box(modifier = modifier, contentAlignment = Alignment.Center) {
101103
BasicTextField(
104+
modifier = Modifier.width(IntrinsicSize.Min),
102105
value = formattedText,
103106
onValueChange = { newValue ->
104107
onTextChange(sanitizeWindowedEditTextContent(newValue, maxLength))
@@ -150,6 +153,12 @@ fun WindowEditTextPreview() {
150153
WindowEditText(
151154
text = content, onTextChange = { content = it }
152155
)
156+
WindowEditText(
157+
text = content,
158+
onTextChange = { content = it },
159+
windowLength = 3,
160+
maxLength = 6,
161+
)
153162
}
154163
}
155164
}

0 commit comments

Comments
 (0)