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

3 hours ago

Summary

  • rowCount is replaced by rows: WheelRows. WheelRows.Count(n) is the previous behavior; the new WheelRows.Height(h) fixes the row height and shows as many rows as fit, like a native iOS picker.
  • Wheel rows are now laid out on a cylinder ("barrel projection") in all pickers, configurable through the new barrelProperties parameter.
  • Wheel callbacks no longer fire on first composition, and onScrollFinished no longer fires twice for one scroll gesture.
  • Source- and binary-breaking against 1.4.x — recompile anything built against 1.4.x. Code compiled against 1.3.x that calls the pickers still links through the hidden compatibility overloads.
  • Docs: restructured README, a Chinese README, a docs/ folder, a migration guide, and a live Wasm demo.

⚠️ Breaking changes

  • rowCount: Int is replaced by rows: WheelRows on WheelDatePicker, WheelTimePicker, WheelDateTimePicker and WheelTextPicker. WheelRows.Count(n) is the previous behavior (default Count(3)).
  • Even counts are laid out as the next odd number so the selected row is centered: Count(4) shows the same five rows as Count(5), while Count(4).count stays 4. The extra row also counts toward the default height. Before, an even rowCount rendered half a row cut off at each rim.
  • Not binary compatible with 1.4.x. The 1.4.x signatures of the four pickers (the ones with rowCount) no longer exist in the binary, so code compiled against 1.4.x, including libraries that depend on this one, must be recompiled against 1.5.0.
  • The look changes. Rows sit on a barrel instead of the previous per-row tilt and fade. With WheelRows.Count they span the drum from rim to rim; for odd counts (including the default 3) the centered row is slightly taller than height / count and picker sizes are unchanged.

🔧 Migration

// Before
WheelDatePicker(rowCount = 5) { }
// After
WheelDatePicker(rows = WheelRows.Count(5)) { }

// Flatter wheel; 0f means no projection at all
WheelDatePicker(
  barrelProperties = WheelPickerDefaults.barrelProperties(rimAngle = 0f),
) { }
  • Full guide, including the iOS look and fade settings: MIGRATION.md.

✨ Added

  • WheelRows.Height(h) fixes the row and selector height instead of the row count. Its intrinsic picker height is seven rows and its default rim angle is 90°.
  • barrelProperties parameter, created with WheelPickerDefaults.barrelProperties(rimAngle, fadeStrength). rimAngle is 0 to 90; fadeStrength is any non-negative finite value (default 1; 0f keeps every row opaque).
  • Without barrelProperties, the rim angle follows rows: for WheelRows.Count it is 13° × (rows − 1), capped at 70° (26° for the default 3 rows, the 70° cap from 7 rows on); for WheelRows.Height it is the full 90°.
  • Rows fade by their on-screen distance from the center, so the fade looks the same at any angle and also applies to a flat wheel.
  • WheelTextPicker now defaults to rows = WheelRows.Count(3), like the other pickers.
  • The barrel projection is based on the contribution by @bnrdk in #150.

🐛 Fixed

  • Wheel callbacks no longer fire on first composition: positioning the wheels at startDate / startTime no longer triggers onScrollChanged / onSnappedDateChanged (#71).
  • onScrollFinished no longer fires twice for one scroll gesture (#71).
  • startDate / startTime outside the minDate / maxDate (minTime / maxTime) bounds is now coerced into range.
  • Date pickers deduplicate consecutive onSnappedDateChanged notifications that resolve to the same date.
  • Rows more than four positions from the center no longer render mirrored.

📦 Installation

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

What's Changed

  • chore(sample): log picker callbacks via Kermit by @darkokoa in #143
  • fix(core): prevent duplicate and initial-composition wheel callbacks by @darkokoa in #144
  • chore(build): modernize gradle build configuration by @darkokoa in #145
  • chore(deps): update agp to v9.3.1 by @renovate[bot] in #140
  • chore(deps): update kotlin monorepo to v2.4.10 by @renovate[bot] in #139
  • fix(deps): update compose to v1.12.0 by @renovate[bot] in #152
  • chore(deps): update lyricist to v1.9.0 by @darkokoa in #153
  • feat!: project wheel rows onto a barrel by @darkokoa in #157
  • feat!: replace rowCount with WheelRows by @darkokoa in #158
  • feat(barrel)!: fade wheel rows by on-screen position by @darkokoa in #160
  • fix(deps): update compose to v1.12.1 by @renovate[bot] in #159
  • fix(deps): update dependency co.touchlab:kermit to v2.2.0 by @renovate[bot] in #156
  • chore(deps): update kotlin monorepo to v2.4.20 by @renovate[bot] in #155
  • ci: fix the Wasm sample build and deploy it to GitHub Pages by @darkokoa in #161
  • docs: restructure README, add docs/, MIGRATION.md and a zh-CN translation by @darkokoa in #162
  • chore(release): bump to 1.5.0 by @darkokoa in #163

Full Changelog: v1.4.0...v1.5.0

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

NewReleases is sending notifications on new releases.