Skip to content

Instantly share code, notes, and snippets.

@merttoptas
Created April 24, 2022 12:46
Show Gist options
  • Save merttoptas/b3665aa885fd8ab723b10662ec4b1278 to your computer and use it in GitHub Desktop.
Save merttoptas/b3665aa885fd8ab723b10662ec4b1278 to your computer and use it in GitHub Desktop.
@Composable
fun BloomTextField(
modifier: Modifier = Modifier,
value: String,
onValueChange: (String) -> Unit,
leadingIcon: @Composable (() -> Unit)? = null,
trailingIcon: @Composable (() -> Unit)? = null,
placeholder: @Composable (() -> Unit)? = null,
visualTransformation: VisualTransformation = VisualTransformation.None,
keyboardOptions: KeyboardOptions = KeyboardOptions.Default,
keyboardActions: KeyboardActions = KeyboardActions(),
singleLine: Boolean = true
) {
OutlinedTextField(
modifier = modifier
.height(56.dp)
.fillMaxWidth(),
value = value,
onValueChange = onValueChange,
shape = RoundedCornerShape(10.dp),
colors = TextFieldDefaults.textFieldColors(
backgroundColor = MaterialTheme.colors.surface,
textColor = MaterialTheme.colors.onBackground,
cursorColor = MaterialTheme.colors.primary,
focusedIndicatorColor = Color.Transparent,
unfocusedIndicatorColor = Color.Transparent,
disabledIndicatorColor = Color.Transparent,
errorIndicatorColor = Color.Transparent
),
textStyle = MaterialTheme.typography.body1,
singleLine = singleLine,
leadingIcon = leadingIcon,
trailingIcon = trailingIcon,
visualTransformation = visualTransformation,
keyboardActions = keyboardActions,
keyboardOptions = keyboardOptions,
placeholder = placeholder
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment