@@ -13,12 +13,12 @@ import androidx.compose.foundation.layout.Arrangement
13
13
import androidx.compose.foundation.layout.Column
14
14
import androidx.compose.foundation.layout.Row
15
15
import androidx.compose.foundation.layout.widthIn
16
- import androidx.compose.material.*
17
16
import androidx.compose.material.icons.Icons
17
+ import androidx.compose.material.icons.automirrored.filled.Backspace
18
18
import androidx.compose.material.icons.filled.Add
19
- import androidx.compose.material.icons.filled.Backspace
20
19
import androidx.compose.material.icons.filled.Palette
21
20
import androidx.compose.material.icons.filled.Remove
21
+ import androidx.compose.material3.*
22
22
import androidx.compose.runtime.*
23
23
import androidx.compose.ui.Alignment
24
24
import androidx.compose.ui.Modifier
@@ -90,7 +90,7 @@ private fun <T> ButtonGroupItem(
90
90
) { option ->
91
91
Text (
92
92
text = formatValue(option),
93
- style = MaterialTheme .typography.caption
93
+ style = MaterialTheme .typography.labelMedium
94
94
)
95
95
}
96
96
}
@@ -139,19 +139,18 @@ private fun <T> MenuItem(
139
139
text = {
140
140
Text (
141
141
text = formatValue(value),
142
- style = MaterialTheme .typography.caption
142
+ style = MaterialTheme .typography.labelMedium
143
143
)
144
144
}
145
145
) { dismiss ->
146
146
for (aValue in values) {
147
147
DropdownMenuItem (
148
+ text = { Text (formatValue(aValue)) },
148
149
onClick = {
149
150
dismiss()
150
151
onValueChanged(aValue)
151
152
}
152
- ) {
153
- Text (formatValue(aValue))
154
- }
153
+ )
155
154
}
156
155
}
157
156
}
@@ -308,7 +307,7 @@ private fun ColorItem(
308
307
309
308
OutlinedButton (
310
309
onClick = { isPicking = true },
311
- colors = ButtonDefaults .buttonColors(backgroundColor = color)
310
+ colors = ButtonDefaults .buttonColors(containerColor = color)
312
311
) {
313
312
if (noValueSelected) {
314
313
Icon (
@@ -367,7 +366,6 @@ fun LanguageItem(
367
366
)
368
367
}
369
368
370
- @OptIn(ExperimentalMaterialApi ::class )
371
369
@Composable
372
370
private fun Item (
373
371
title : String ,
@@ -383,19 +381,18 @@ private fun Item(
383
381
} else {
384
382
Modifier
385
383
},
386
- text = {
387
- val alpha = if (isActive) 1.0f else ContentAlpha .disabled
388
- CompositionLocalProvider (LocalContentAlpha provides alpha) {
384
+ headlineContent = {
385
+ Group (enabled = isActive) {
389
386
Text (title)
390
387
}
391
388
},
392
- trailing = {
389
+ trailingContent = {
393
390
Row {
394
391
content()
395
392
396
393
IconButton (onClick = onClear ? : {}, enabled = onClear != null ) {
397
394
Icon (
398
- Icons .Default .Backspace ,
395
+ Icons .AutoMirrored . Filled .Backspace ,
399
396
contentDescription = " Clear"
400
397
)
401
398
}
@@ -427,7 +424,6 @@ fun <T> SelectorListItem(
427
424
* A Material [ListItem] displaying a dropdown menu to select a value. The current value is
428
425
* displayed on the right.
429
426
*/
430
- @OptIn(ExperimentalMaterialApi ::class )
431
427
@Composable
432
428
private fun <T > SelectorListItem (
433
429
title : String ,
@@ -445,12 +441,12 @@ private fun <T> SelectorListItem(
445
441
.clickable(enabled = enabled) {
446
442
isExpanded = true
447
443
},
448
- text = {
444
+ headlineContent = {
449
445
Group (enabled = enabled) {
450
446
Text (title)
451
447
}
452
448
},
453
- trailing = {
449
+ trailingContent = {
454
450
Group (enabled = enabled) {
455
451
Text (formatValue(selection))
456
452
}
@@ -461,13 +457,12 @@ private fun <T> SelectorListItem(
461
457
) {
462
458
for (value in values) {
463
459
DropdownMenuItem (
460
+ text = { Text (formatValue(value)) },
464
461
onClick = {
465
462
onSelected(value)
466
463
dismiss()
467
464
}
468
- ) {
469
- Text (formatValue(value))
470
- }
465
+ )
471
466
}
472
467
}
473
468
}
0 commit comments