https://kotlinlang.org logo
#compose
Title
# compose
t

Travis Griggs

09/22/2023, 9:54 PM
I'm looking for a compact(ish) inline datetime picker. For our app, the old iOS spinner actually works really well, because the targets tend to be in the near temporal vicinity (plus or minus a week) and minute resolution is just right. I'm not seeing anything in M3 like this. Just large independent date or time pickers, none that put the two together. I really don't want to roll my own (not even sure my skill is up to that yet). Can anyone recommend any solid 3rd party implementations of something like this. I'm not beholden to this display format. Just looking for an inline way to select date, and time coincidently to a minute resolution.
m

myanmarking

09/22/2023, 10:27 PM
There is no native or library that i am aware of. That component as you displayed is very easy to fo. Just three lazycolumn with snap behavior. The hardest part is to detect the center so you can have the selected state
Just try it :p 1 day of work should do it
For performance you can create your own list impl that gets the dates ondemand. To avoid allocate the full range of dates and times
t

Travis Griggs

09/22/2023, 10:40 PM
OK... gauntlet thrown. Especially after having played with the M3 TimePicker (are they for real with this thing?) Thank you for the encouragement. I'll have a go at it. And hopefully learn some new things in general in the process. And hopefully get some help on the way :D
t

Travis Griggs

09/25/2023, 3:42 PM
Thanks @Mark Murphy! I really like that first one. It's not quite what I want, but close enough that I think I can glean some technique from it.
👍🏻 1
2 Views