Skip to content

commandiron/WheelPickerCompose

master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
.
Sep 7, 2022
app
Sep 20, 2022
Sep 7, 2022
Sep 8, 2022

WheelPickerCompose

Add Wheel Picker in Android Jetpack Compose.

Usage

Picker Usage
WheelDateTimePicker { snappedDateTime -> }
WheelDatePicker { snappedDate -> }
WheelTimePicker { snappedTime -> }
WheelTextPicker(texts = (1..6).map { "Text $it" })
WheelPicker(count = 6) { index, snappedIndex ->
      Card(Modifier.size(128.dp).padding(8.dp)) {}
}

Setup

  1. Open the file settings.gradle (it looks like that)
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        // add jitpack here 👇🏽
        maven { url 'https://jitpack.io' }
       ...
    }
} 
...
  1. Sync the project
  2. Add dependency
dependencies {
        implementation 'com.github.commandiron:WheelPickerCompose:1.0.9'
}

Features

WheelDateTimePicker(
    currentDateTime = LocalDateTime.of(
        2025, 10, 30, 5, 0
    ),
    yearRange = 100,
    disablePastDateTime = true,
    size = DpSize(200.dp, 100.dp),
    textStyle = MaterialTheme.typography.titleSmall,
    textColor = Color(0xFFffc300),
    selectorEnabled = true,
    selectorShape = RoundedCornerShape(0.dp),
    selectorColor = Color(0xFFf1faee).copy(alpha = 0.2f),
    selectorBorder = BorderStroke(2.dp, Color(0xFFf1faee))
) { snappedDateTime -> }