github darkokoa/compose-datetime-wheel-picker v1.4.0

one month ago

Summary

  • Picker size is now driven entirely by Modifier and the parent's constraints — the size: DpSize parameter is gone.
  • The selected (centered) item can be styled independently via selectedTextStyle / selectedTextColor.
  • Smoother scrolling: less recomposition per selection change and less text measurement for CJK pickers.
  • Source-breaking — binaries compiled against 1.3.x still link via hidden compatibility overloads, which will be removed in the next major release.

⚠️ Breaking changes

  • Removed the size: DpSize parameter from WheelDatePicker, WheelTimePicker, WheelDateTimePicker, and WheelTextPicker. Size now comes from Modifier and the parent's constraints.
  • Defaults when an axis is unconstrained: width 256.dp (date, date-time) / 128.dp (time, text); height (128.dp / 3) * rowCount — so rowCount = 3 is still 128.dp, but a larger rowCount now grows the wheel instead of squeezing rows.
  • Renamed WheelTextPicker parameters: styletextStyle, colortextColor.
  • Invalid sizing input now throws IllegalArgumentException eagerly (non-positive rowCount, non-finite or non-positive viewport height).

🔧 Migration

// Before
WheelDatePicker(size = DpSize(300.dp, 160.dp)) { }
// After
WheelDatePicker(modifier = Modifier.size(300.dp, 160.dp)) { }

// Before — responsive width workaround
BoxWithConstraints(Modifier.fillMaxWidth()) {
  WheelDatePicker(size = DpSize(maxWidth, 200.dp)) { }
}
// After
WheelDatePicker(modifier = Modifier.fillMaxWidth().height(200.dp)) { }

// Keep the old total height for rowCount > 3
WheelDatePicker(modifier = Modifier.height(128.dp), rowCount = 5) { }
  • More examples: Sizing in the README.

✨ Added

  • selectedTextStyle / selectedTextColor to style the selected (centered) item independently, across date, time, date-time and text pickers — including the time separator and the CJK date suffixes (年/月/日, 년/월/일).
  • Both default to textStyle / textColor, so nothing changes unless you set them.

🐛 Fixed & improved

  • onScrollChanged / onScrollFinished are no longer captured stale (rememberUpdatedState).
  • Less recomposition on selection change, less text measurement for CJK pickers, and time picker column widths now update when the container is resized.
  • Partial TextStyles are merged with the defaults, so you can override just a few attributes.

📌 Known limitation

  • Sizing is resolved via subcomposition, so intrinsic-measurement parents (IntrinsicSize.Min / Max) will throw — pass an explicit width / height instead.

📦 Installation

implementation("io.github.darkokoa:datetime-wheel-picker:1.4.0")
  • Built with Kotlin 2.4.0, Compose Multiplatform 1.11.1, kotlinx-datetime 0.8.0, AGP 9.2.1, KSP 2.3.10.
  • Targets: Android (minSdk 21), JVM/Desktop, iOS (iosArm64, iosSimulatorArm64), JS, Wasm/JS.

What's Changed

  • fix(core): use rememberUpdatedState to avoid stale callback capture in WheelPicker by @darkokoa in #135
  • perf(core): optimize WheelPicker scroll rendering and reject invalid sizing inputs by @darkokoa in #136
  • feat(core)!: support distinct selected item text styling by @darkokoa in #138
  • chore(deps): update dependency com.google.devtools.ksp to v2.3.10 by @renovate[bot] in #137
  • feat(core)!: make picker size follow the Modifier by @darkokoa in #142

Full Changelog: v1.3.3...v1.4.0

Don't miss a new compose-datetime-wheel-picker release

NewReleases is sending notifications on new releases.