@@ -190,8 +190,16 @@ fun SliderTestView() {
190190 }
191191 },
192192 label = stringResource(R .string.font_weight),
193+ useLabelAsPlaceholder = true ,
193194 keyboardOptions = KeyboardOptions (imeAction = ImeAction .Done ),
194195 keyboardActions = KeyboardActions (onDone = { focusManager.clearFocus() }),
196+ trailingIcon = {
197+ Text (
198+ text = stringResource(R .string.font_weight),
199+ fontSize = 13 .sp,
200+ modifier = Modifier .padding(horizontal = 16 .dp)
201+ )
202+ }
195203 )
196204 Slider (
197205 progress = fontWeightValue.toFloat(),
@@ -219,8 +227,16 @@ fun SliderTestView() {
219227 }
220228 },
221229 label = stringResource(R .string.font_size),
230+ useLabelAsPlaceholder = true ,
222231 keyboardOptions = KeyboardOptions (imeAction = ImeAction .Done ),
223232 keyboardActions = KeyboardActions (onDone = { focusManager.clearFocus() }),
233+ trailingIcon = {
234+ Text (
235+ text = stringResource(R .string.font_size),
236+ fontSize = 13 .sp,
237+ modifier = Modifier .padding(horizontal = 16 .dp)
238+ )
239+ }
224240 )
225241 Slider (
226242 progress = fontSizeValue.toFloat(),
@@ -234,12 +250,31 @@ fun SliderTestView() {
234250 }
235251 }
236252 TextField (
237- modifier = Modifier .padding(top = 12 .dp),
238253 value = customText,
239254 onValueChange = { customText = it },
240255 label = stringResource(R .string.custom_text),
256+ useLabelAsPlaceholder = true ,
241257 keyboardOptions = KeyboardOptions (imeAction = ImeAction .Done ),
242258 keyboardActions = KeyboardActions (onDone = { focusManager.clearFocus() }),
259+ modifier = Modifier .padding(top = 12 .dp),
260+ trailingIcon = {
261+ Text (
262+ text = if (customText.isEmpty()) stringResource(R .string.custom_text) else stringResource(R .string.clear_text),
263+ fontSize = 14 .sp,
264+ modifier = Modifier
265+ .then(
266+ if (customText.isNotEmpty())
267+ Modifier .clickable(
268+ indication = null ,
269+ interactionSource = null ,
270+ ) {
271+ customText = " "
272+ }
273+ else Modifier
274+ )
275+ .padding(horizontal = 16 .dp)
276+ )
277+ }
243278 )
244279 Text (
245280 modifier = Modifier .padding(top = 12 .dp),
0 commit comments