Using `BasicTextField` to achieve text field witho...
# compose
c
Using
BasicTextField
to achieve text field without inner paddings, but then label animation is only happening on text entry, and not on focus (which it does on
TextField
). Is that expected?
z
You’ve written the animation code yourself? Or copied it from material TF?
c
No, I haven't touched anything
Copy code
BasicTextField(
        value = value,
        onValueChange = onValueChange,
        modifier = modifier
            .indicatorLine(
                enabled = enabled,
                isError = isError,
                interactionSource = interactionSource,
                colors = TextFieldDefaults.textFieldColors(
                    focusedIndicatorColor = MaterialTheme.colors.onSurfaceVariant,
                ),
            ),
        enabled = enabled,
        readOnly = readOnly,
        textStyle = textStyle,
        keyboardOptions = keyboardOptions,
        keyboardActions = keyboardActions,
        singleLine = singleLine,
        maxLines = maxLines,
        visualTransformation = visualTransformation,
        onTextLayout = onTextLayout,
        cursorBrush = cursorBrush,
    ) { innerTextField ->
        TextFieldDefaults.TextFieldDecorationBox(
            value = value,
            innerTextField = innerTextField,
            enabled = enabled,
            singleLine = singleLine,
            visualTransformation = visualTransformation,
            interactionSource = interactionSource,
            isError = isError,
            label = label,
            placeholder = placeholder,
            leadingIcon = leadingIcon,
            trailingIcon = trailingIcon,
            colors = colors,
            contentPadding = contentPadding,
        )
    }
Do I have to copy the animation from TF? because to me it looks like the
TextFieldDecorationBox
should take care of that in
CommonDecorationBox
as you can see, on focus, the label is not animated as in TF
apologies for the incorrect icon for signin in with google 😂