-
Notifications
You must be signed in to change notification settings - Fork 77
Expand file tree
/
Copy pathWheelTimePicker.kt
More file actions
50 lines (48 loc) · 1.67 KB
/
WheelTimePicker.kt
File metadata and controls
50 lines (48 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package com.commandiron.wheel_picker_compose
import androidx.compose.material3.LocalContentColor
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.unit.DpSize
import androidx.compose.ui.unit.dp
import com.commandiron.wheel_picker_compose.core.DefaultWheelTimePicker
import com.commandiron.wheel_picker_compose.core.SelectorProperties
import com.commandiron.wheel_picker_compose.core.TimeFormat
import com.commandiron.wheel_picker_compose.core.WheelPickerDefaults
import java.time.LocalTime
import java.util.Locale
@Composable
fun WheelTimePicker(
modifier: Modifier = Modifier,
startTime: LocalTime = LocalTime.now(),
dateLocale: Locale = Locale.getDefault(),
minTime: LocalTime = LocalTime.MIN,
maxTime: LocalTime = LocalTime.MAX,
timeFormat: TimeFormat = TimeFormat.HOUR_24,
size: DpSize = DpSize(128.dp, 128.dp),
rowCount: Int = 3,
textStyle: TextStyle = MaterialTheme.typography.titleMedium,
textColor: Color = LocalContentColor.current,
selectorProperties: SelectorProperties = WheelPickerDefaults.selectorProperties(),
onSnappedTime : (snappedTime: LocalTime) -> Unit = {},
) {
DefaultWheelTimePicker(
modifier,
startTime,
dateLocale,
minTime,
maxTime,
timeFormat,
size,
rowCount,
textStyle,
textColor,
selectorProperties,
onSnappedTime = { snappedTime, _ ->
onSnappedTime(snappedTime.snappedLocalTime)
snappedTime.snappedIndex
}
)
}