-
Notifications
You must be signed in to change notification settings - Fork 52
/
WheelDatePicker.kt
48 lines (46 loc) · 1.57 KB
/
WheelDatePicker.kt
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
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.DefaultWheelDatePicker
import com.commandiron.wheel_picker_compose.core.SelectorProperties
import com.commandiron.wheel_picker_compose.core.WheelPickerDefaults
import java.time.LocalDate
@Composable
fun WheelDatePicker(
modifier: Modifier = Modifier,
startDate: LocalDate = LocalDate.now(),
showDate: Boolean = true,
minDate: LocalDate = LocalDate.MIN,
maxDate: LocalDate = LocalDate.MAX,
yearsRange: IntRange? = IntRange(1922, 2122),
size: DpSize = DpSize(256.dp, 128.dp),
rowCount: Int = 3,
textStyle: TextStyle = MaterialTheme.typography.titleMedium,
textColor: Color = LocalContentColor.current,
selectorProperties: SelectorProperties = WheelPickerDefaults.selectorProperties(),
onSnappedDate : (snappedDate: LocalDate) -> Unit = {}
) {
DefaultWheelDatePicker(
modifier,
startDate,
showDate,
minDate,
maxDate,
yearsRange,
size,
rowCount,
textStyle,
textColor,
selectorProperties,
onSnappedDate = { snappedDate ->
onSnappedDate(snappedDate.snappedLocalDate)
snappedDate.snappedIndex
}
)
}