@@ -397,41 +397,44 @@ private fun UserInputText(
397
397
},
398
398
horizontalArrangement = Arrangement .End
399
399
) {
400
- Box (
401
- modifier = Modifier .preferredHeight(48 .dp).weight(1f ).align(Alignment .Bottom )
402
- ) {
403
- var lastFocusState by remember { mutableStateOf(FocusState .Inactive ) }
404
- BasicTextField (
405
- value = textFieldValue,
406
- onValueChange = { onTextChanged(textFieldValue) },
407
- modifier = Modifier
408
- .fillMaxWidth()
409
- .padding(start = 16 .dp)
410
- .align(Alignment .CenterStart )
411
- .focusObserver { state ->
412
- if (lastFocusState != state) {
413
- onTextFieldFocused(state == FocusState .Active )
414
- }
415
- lastFocusState = state
416
- },
417
- keyboardOptions = KeyboardOptions (
418
- keyboardType = keyboardType,
419
- imeAction = ImeAction .Send
420
- ),
421
- maxLines = 1 ,
422
- cursorColor = AmbientContentColor .current
423
- )
424
-
425
- val disableContentColor =
426
- MaterialTheme .colors.onSurface.copy(alpha = ContentAlpha .disabled)
427
- if (textFieldValue.text.isEmpty() && ! focusState) {
428
- Text (
400
+ Surface {
401
+ Box (
402
+ modifier = Modifier .preferredHeight(48 .dp).weight(1f ).align(Alignment .Bottom )
403
+ ) {
404
+ var lastFocusState by remember { mutableStateOf(FocusState .Inactive ) }
405
+ BasicTextField (
406
+ value = textFieldValue,
407
+ onValueChange = { onTextChanged(it) },
429
408
modifier = Modifier
409
+ .fillMaxWidth()
410
+ .padding(start = 16 .dp)
430
411
.align(Alignment .CenterStart )
431
- .padding(start = 16 .dp),
432
- text = stringResource(id = R .string.textfield_hint),
433
- style = MaterialTheme .typography.body1.copy(color = disableContentColor)
412
+ .focusObserver { state ->
413
+ if (lastFocusState != state) {
414
+ onTextFieldFocused(state == FocusState .Active )
415
+ }
416
+ lastFocusState = state
417
+ },
418
+ keyboardOptions = KeyboardOptions (
419
+ keyboardType = keyboardType,
420
+ imeAction = ImeAction .Send
421
+ ),
422
+ maxLines = 1 ,
423
+ cursorColor = AmbientContentColor .current,
424
+ textStyle = AmbientTextStyle .current.copy(color = AmbientContentColor .current)
434
425
)
426
+
427
+ val disableContentColor =
428
+ MaterialTheme .colors.onSurface.copy(alpha = ContentAlpha .disabled)
429
+ if (textFieldValue.text.isEmpty() && ! focusState) {
430
+ Text (
431
+ modifier = Modifier
432
+ .align(Alignment .CenterStart )
433
+ .padding(start = 16 .dp),
434
+ text = stringResource(id = R .string.textfield_hint),
435
+ style = MaterialTheme .typography.body1.copy(color = disableContentColor)
436
+ )
437
+ }
435
438
}
436
439
}
437
440
}
0 commit comments