Skip to content

Commit 35de70e

Browse files
committed
Make minor adjustments to pickers
1 parent 9fbc478 commit 35de70e

File tree

3 files changed

+12
-15
lines changed

3 files changed

+12
-15
lines changed

multipickers/src/main/java/github/returdev/multipickers/types/number/NumberPicker.kt

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
package github.returdev.multipickers.types.number
22

3-
import androidx.compose.material3.MaterialTheme
43
import androidx.compose.runtime.Composable
54
import androidx.compose.ui.ExperimentalComposeUiApi
65
import androidx.compose.ui.Modifier
76
import androidx.compose.ui.text.TextStyle
8-
import androidx.compose.ui.text.font.FontWeight
97
import androidx.compose.ui.unit.Dp
8+
import androidx.compose.ui.unit.dp
109
import github.returdev.multipickers.core.PickerDefaults
1110
import github.returdev.multipickers.core.PickerItemColors
1211
import github.returdev.multipickers.core.PickerState
@@ -17,7 +16,7 @@ import github.returdev.multipickers.types.text.TextPicker
1716
*
1817
* @param modifier The modifier to be applied to the TextPicker. Defaults to [Modifier].
1918
* @param items The list of integers to be displayed in the picker.
20-
* @param pickerItemHeight The height of each item in the picker.
19+
* @param pickerItemHeight The height of each item in the picker. Defaults to 0.dp.
2120
* @param isEnabled Whether the picker is enabled or not. Defaults to true.
2221
* @param colors The colors to be used for the picker items. Defaults to [PickerDefaults.pickerItemColors()].
2322
* @param textStyle The text style to be used for the picker items. Defaults to a bold headline medium style from the current MaterialTheme.
@@ -28,11 +27,11 @@ import github.returdev.multipickers.types.text.TextPicker
2827
fun NumberPicker(
2928
modifier: Modifier = Modifier,
3029
items: List<Int>,
31-
pickerItemHeight : Dp,
32-
isEnabled: Boolean = true,
30+
pickerItemHeight : Dp = 0.dp,
31+
pickerState: PickerState,
3332
colors : PickerItemColors = PickerDefaults.pickerItemColors(),
3433
textStyle : TextStyle = PickerDefaults.pickerTextStyle,
35-
pickerState: PickerState
34+
isEnabled: Boolean = true
3635
) {
3736
// Converts the list of integers to a list of strings for TextPicker.
3837
val stringItems = items.map { it.toString() }

multipickers/src/main/java/github/returdev/multipickers/types/text/TextPicker.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import github.returdev.multipickers.core.PickerState
2424
*
2525
* @param modifier Modifier to be applied to the TextPicker.
2626
* @param items The list of text items to be displayed in the TextPicker.
27-
* @param pickerItemHeight The height of each item in the Picker.
27+
* @param pickerItemHeight The height of each item in the Picker. Defaults to 0.dp.
2828
* @param pickerState The state of the Picker, which includes the current selected index and the total number of items.
2929
* @param colors The colors to be used for the Picker items.
3030
* @param textStyle The style of the text in the Picker items.
@@ -36,7 +36,7 @@ import github.returdev.multipickers.core.PickerState
3636
fun TextPicker(
3737
modifier : Modifier = Modifier,
3838
items : List<String>,
39-
pickerItemHeight : Dp,
39+
pickerItemHeight : Dp = 0.dp,
4040
pickerState: PickerState,
4141
colors : PickerItemColors = PickerDefaults.pickerItemColors(),
4242
textStyle : TextStyle = PickerDefaults.pickerTextStyle,

multipickers/src/main/java/github/returdev/multipickers/types/time/TimePicker.kt

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,12 @@ package github.returdev.multipickers.types.time
22

33
import androidx.compose.foundation.layout.Arrangement
44
import androidx.compose.foundation.layout.Row
5-
import androidx.compose.foundation.layout.width
6-
import androidx.compose.material3.MaterialTheme
75
import androidx.compose.material3.Text
86
import androidx.compose.runtime.Composable
9-
import androidx.compose.runtime.remember
107
import androidx.compose.ui.Alignment
118
import androidx.compose.ui.ExperimentalComposeUiApi
129
import androidx.compose.ui.Modifier
1310
import androidx.compose.ui.text.TextStyle
14-
import androidx.compose.ui.text.font.FontWeight
1511
import androidx.compose.ui.unit.Dp
1612
import androidx.compose.ui.unit.dp
1713
import github.returdev.multipickers.core.PickerDefaults
@@ -23,17 +19,17 @@ import github.returdev.multipickers.types.text.TextPicker
2319
* This composable function creates a TimePicker.
2420
*
2521
* @param modifier The modifier to be applied to the TimePicker. Defaults to [Modifier].
26-
* @param pickerItemHeight The height of each item in the picker.
22+
* @param pickerItemHeight The height of each item in the picker. Defaults to 0.dp.
2723
* @param pickerState The state of the picker.
2824
* @param colors The colors to be used for the picker items. Defaults to [PickerDefaults.pickerItemColors()].
2925
* @param textStyle The text style to be used for the picker items. Defaults to a bold headline medium style from the current MaterialTheme.
3026
* @param isEnabled Whether the picker is enabled or not. Defaults to true.
3127
*/
32-
@OptIn(ExperimentalComposeUiApi::class)
28+
@ExperimentalComposeUiApi
3329
@Composable
3430
fun TimePicker(
3531
modifier : Modifier = Modifier,
36-
pickerItemHeight : Dp,
32+
pickerItemHeight : Dp = 0.dp,
3733
pickerState : TimePickerState,
3834
colors : PickerItemColors = PickerDefaults.pickerItemColors(),
3935
textStyle : TextStyle = PickerDefaults.pickerTextStyle,
@@ -68,6 +64,7 @@ fun TimePicker(
6864
*/
6965
Text(
7066
text = ":",
67+
color = colors.selectedContentColor(enabled = isEnabled).value,
7168
style = textStyle
7269
)
7370
/**
@@ -87,6 +84,7 @@ fun TimePicker(
8784
*/
8885
Text(
8986
text = ":",
87+
color = colors.selectedContentColor(enabled = isEnabled).value,
9088
style = textStyle
9189
)
9290
/**

0 commit comments

Comments
 (0)