-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSample.kt
50 lines (46 loc) · 1.62 KB
/
Sample.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
49
50
package com.compose.widget.sample
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.runtime.*
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.colorResource
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import java.time.LocalTime
@Composable
fun BottomTimePicker(
currentTime: LocalTime? = null,
is24TimeFormat: Boolean
) {
var time by remember { mutableStateOf(currentTime ?: LocalTime.now()) }
PickerContainer(
modifier = Modifier.padding(18.dp),
backgroundColor = colorResource(id = R.color.green_grey),
cornerRadius = 15.dp, fadingEdgeLength = 60.dp
) {
TimePicker(
modifier = Modifier.height(130.dp),
itemHeight = 40.dp,
is24TimeFormat = is24TimeFormat,
itemStyles = ItemStyles(
defaultTextStyle = TextStyle(
Color.DarkGray,
fontSize = 18.sp,
fontWeight = FontWeight.Medium
),
selectedTextStyle = TextStyle(
Color.Black,
fontSize = 18.sp,
fontWeight = FontWeight.Black
)
),
onTimeChanged = {
time = it
},
currentTime = time
)
}
}