disableWritingModeOnFocusGain
Extension Modifier function to apply to the components which have to manage the currentActiveWritingMode, this method allows to disable the writing mode when the component where this method is applied gains focus
Usage example:
val isWritingMode = remember { mutableStateOf(false) }
Scaffold(
modifier = Modifier
.disableWritingModeOnTap(), // clicking on any point of the Scaffold will disable the writing mode
topBar = {
LargeTopAppBar(
colors = TopAppBarDefaults.topAppBarColors(
containerColor = MaterialTheme.colorScheme.primary
),
title = {
val text = remember { mutableStateOf("any_text") }
WriteableText(
isInWritingMode = isWritingMode,
writeableText = text,
placeholder = "placeholder"
)
}
)
}
) {
val value = remember { mutableStateOf("") }
Column(
modifier = Modifier
.fillMaxSize(),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center
) {
EquinoxTextField(
modifier = Modifier
.disableWritingModeOnFocusGain(), // when this component gains the focus will disable the writing mode
value = value,
label = "label"
)
}
}
Content copied to clipboard