/compose-datetime-wheel-picker

Wheel Date & Time Picker in Compose Multiplatform

Primary LanguageKotlin

datetime-wheel-picker (work-in-progress 👷🔧️👷‍♀️⛏)

badge-version-main badge-android badge-jvm badge-ios badge-js

Compose Multiplatform implementation of WheelPickerCompose.

Picker Usage
WheelDateTimePicker { snappedDateTime -> }
WheelDatePicker { snappedDate -> }
WheelTimePicker { snappedTime -> }
WheelTimePicker(timeFormat = TimeFormat.AM_PM) { snappedTime -> }

Features

WheelDateTimePicker(
  startDateTime = LocalDateTime(
    year = 2025,
    monthNumber = 10,
    dayOfMonth = 20,
    hour = 5,
    minute = 30
  ),
  minDateTime = Clock.System
    .now()
    .toLocalDateTime(TimeZone.currentSystemDefault()),
  maxDateTime = LocalDateTime(
    year = 2025,
    monthNumber = 10,
    dayOfMonth = 20,
    hour = 5,
    minute = 30
  ),
  timeFormat = TimeFormat.AM_PM,
  size = DpSize(200.dp, 100.dp),
  rowCount = 5,
  textStyle = MaterialTheme.typography.titleSmall,
  textColor = Color(0xFFffc300),
  selectorProperties = WheelPickerDefaults.selectorProperties(
    enabled = true,
    shape = RoundedCornerShape(0.dp),
    color = Color(0xFFf1faee).copy(alpha = 0.2f),
    border = BorderStroke(2.dp, Color(0xFFf1faee))
  )
) { snappedDateTime -> }

Setup

datetime-wheel-picker has multiple active versions. The higher one uses the latest versions for Compose, while the others use only stable versions. Choose the one that matches your Compose version, considering this table:

Compose Version datetime-wheel-picker Version
Compose 1.3 - 1.6 badge-version-main
Compose 1.7 badge-version-compose1.7
  • Add the Maven Central repository if it is not already there:
repositories {
  mavenCentral()
}
  • In Compose multiplatform projects, add a dependency to the commonMain source set dependencies:
kotlin {
  sourceSets {
    val commonMain by getting {
      dependencies {
        implementation("io.github.darkokoa:datetime-wheel-picker:<version>")
        implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.6.1")
      }
    }
  }
}
  • To use the library in a single-platform project (such as Android project), add a dependency to the dependencies block:
dependencies {
  implementation("io.github.darkokoa:datetime-wheel-picker:<version>")
  implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.6.1")
}
  • If your minimum Android platform's API level (minSdk) < 26, please enable Desugaring like this:
compileOptions {
  isCoreLibraryDesugaringEnabled = true
}

//...

dependencies {
  coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.0.4")
}

License

Released under the Apache License, Version 2.0.

Thx

WheelPickerCompose