Spinwheel for Android using Jetpack Compose.

Overview

SpinwheelCompose

SpinWheel in Android using Jetpack Compose.

How it looks

Usage

val textList by remember { 
    mutableStateOf(
        listOf("Pie 1", "Pie 2", "Pie 3", "Pie 4", "Pie 5", "Pie 6", "Pie 7", "Pie 8")
    )
}
DefaultSpinWheel(isSpinning = true){ pieIndex ->
    Text(text = textList[pieIndex])
}

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:SpinWheelCompose:1.0.3'
}

Features

val iconList by remember {
    mutableStateOf(
        listOf(
            Icons.Default.Star,
            Icons.Default.Star,
            Icons.Default.Star,
            Icons.Default.Star,
        )
    )
}
var isSpinning by remember { mutableStateOf(false)}
repeat(3){
    DefaultSpinWheel(
        dimensions = SpinWheelDefaults.spinWheelDimensions(
            spinWheelSize = 180.dp,
            frameWidth = 20.dp,
            selectorWidth = 10.dp
        ),
        colors = SpinWheelDefaults.spinWheelColors(
            frameColor = Color(0xFF403d39),
            dividerColor = Color(0xFFfffcf2),
            selectorColor = Color(0xFFdc0073),
            pieColors = listOf(
                Color(0xFFdabfff),
                Color(0xFF907ad6),
                Color(0xFF4f518c),
                Color(0xFF2c2a4a)
            )
        ),
        animationAttr = SpinWheelDefaults.spinWheelAnimationAttr(
            pieCount = 4,
            durationMillis = 4000,
            delayMillis = 200,
            rotationPerSecond = 2f,
            easing = LinearOutSlowInEasing,
            startDegree = 90f
        ),
        isSpinning = isSpinning,
        onClick = { isSpinning = !isSpinning },
        onFinish = { isSpinning = false }
    ){ pieIndex ->
        Icon(
            imageVector = iconList[pieIndex],
            tint = Color.White,
            contentDescription = null
        )
    }
    Spacer(modifier = Modifier.height(32.dp))
}
You might also like...
Build with Jetpack Compose & all modern techniques and architecture of android app development
Build with Jetpack Compose & all modern techniques and architecture of android app development

IMDB Movie App Build with Jetpack Compose & all modern techniques and architecture of android app development ScreenShots 🛠 Built With 🛠 Kotlin - Fi

Affogato is a multipurpose library for Android, Jetpack Compose and Kotlin.
Affogato is a multipurpose library for Android, Jetpack Compose and Kotlin.

Affogato Affogato is a multipurpose library for Jetpack Compose, Android and Kotlin. Core-ktx Core-ktx is a Kotlin library that provides a set of Kotl

AnKunv2 is an Android application built with Jetpack Compose to stream anime on demand.
AnKunv2 is an Android application built with Jetpack Compose to stream anime on demand.

AnKunv2 AnKunv2 is an app a bit similar to YouTube but to stream anime. Updated from AnKun using Jetpack Compose. Tech Stack Kotlin AndroidX UI - Jetp

Ejemplo de App Android con Kotlin, Jetpack Compose, Retrofit y consumo de la API REST de Pokémon
Ejemplo de App Android con Kotlin, Jetpack Compose, Retrofit y consumo de la API REST de Pokémon

Pokémon Jetpack Compose Ejemplo de App Android con Kotlin, Jetpack Compose, Retrofit y consumo de la API REST de Pokémon Jetpack Compose Retrofit Poké

Add Expandable Horizontal Pager in Android Jetpack Compose.
Add Expandable Horizontal Pager in Android Jetpack Compose.

ExpandableHorizontalPagerCompose Add Expandable Horizontal Pager in Android Jetpack Compose. How it looks Usage BoxWithConstraints( modifier = Mod

Add Ios Swipe Search TextField Component in Android Jetpack Compose.
Add Ios Swipe Search TextField Component in Android Jetpack Compose.

IosSwipeSearchCompose Add Ios Swipe Search TextField Component in Android Jetpack Compose. How it looks Usage val text = remember { mutableStateOf("")

Jetpack Compose for Desktop and Web, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.
Jetpack Compose for Desktop and Web, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.

Jetpack Compose for Desktop and Web, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.

New style for app design Online Sunglasses Shop App UI made in Jetpack Compose.😉😎
New style for app design Online Sunglasses Shop App UI made in Jetpack Compose.😉😎

JetSunglassUI-Android New style for app design Online Sunglasses Shop App UI made in Jetpack Compose. 😉 😎 (Navigation Components, Dagger-Hilt, Mater

Counterpart of onTouchEvent for Jetpack Compose and transform gesture with specific number of pointers

Counterpart of onTouchEvent for Jetpack Compose and transform gestures notify when last pointer is up number of pointer that are down or list of pointers that can be used to get details of events when gesture is on

Comments
  • Default values

    Default values

    I think some of the default behaviour is not obvious without looking through the code:

    • When not providing resultDegree, the spin should be random
    • When not providing autoResetDelay, the spinner should not reset.
    bug enhancement 
    opened by MadSoeDK 2
  • 1.1.0

    1.1.0

    • re write most of the codes.
    • bugs fixed.
    • spinWheelState added so code made more elegant and readable
    • Now the animation will be started with the animate() suspend function.

    Functions added;

    • For spin and reset -> animate()

    • For spin -> spin()

    • For reset -> reset()

    • resultDegree default value is null and this means random value.

    • autoSpinDelay default value is null and this means no auto spin.

    • startDegree bug fixed.

    etc.

    opened by commandiron 0
Releases(1.1.1)
Owner
Emir Demirli
Android, Kotlin.
Emir Demirli
FirestoreCleanArchitectureApp is an app built with Kotlin and Firestore that displays data in real-time using the MVVM Architecture Pattern. For the UI it uses Jetpack Compose, Android's modern toolkit for building native UI.

FirestoreCleanArchitectureApp FirestoreCleanArchitectureApp is an app built with Kotlin and Cloud Firestore that displays data in real-time using Andr

Alex 66 Dec 15, 2022
PhotoSearch is an Android TV app using Jetpack Compose.

PhotoSearch What's PhotoSearch? ?? PhotoSearch is an Android TV app using Jetpack Compose UI. The purpose of this project is to try new Android techno

Erick Tijero 4 Nov 18, 2022
A clone of Zomato, A Online Food Ordering App using Jetpack Compose

Zomato-Clone A clone of Zomato, A Online Food Ordering App using Jetpack Compose Below are a few Screenshots of the app till now -> Screens Demo Login

Yugesh Jain 52 Nov 27, 2022
Math Your Brain is a math game built using Jetpack Compose and Modern MVVM Architecture

Math Your Brain is a math game built using Jetpack Compose and Modern MVVM Architecture. I built this so that programmers learning Jetpack Compose Can use this repository as a learning material for Jetpack Compose.

Somnath Mishra 47 Jan 1, 2023
📚 Sample Android Components Architecture on a modular word focused on the scalability, testability and maintainability written in Kotlin, following best practices using Jetpack.

Android Components Architecture in a Modular Word Android Components Architecture in a Modular Word is a sample project that presents modern, 2020 app

Madalin Valceleanu 2.3k Dec 30, 2022
Modular Android architecture which showcase Kotlin, MVVM, Navigation, Hilt, Coroutines, Jetpack compose, Retrofit, Unit test and Kotlin Gradle DSL.

SampleCompose Modular Android architecture which showcase Kotlin, MVVM, Navigation, Hilt, Coroutines, Jetpack compose, Retrofit, Unit test and Kotlin

Mohammadali Rezaei 7 Nov 28, 2022
Clean Android multi-module offline-first scalable app in 2022. Including Jetpack Compose, MVI, Kotlin coroutines/Flow, Kotlin serialization, Hilt and Room.

Android Kotlin starter project - 2022 edition Android starter project, described precisely in this article. Purpose To show good practices using Kotli

Krzysztof Dąbrowski 176 Jan 3, 2023
Android & iPhone payments apps built w/ SwiftUI & Jetpack Compose

Android & iPhone payments apps built w/ SwiftUI & Jetpack Compose, the apps persist data locally w/ SQLDelight and Remote w/ Firebase., Payments w/ Stripe and are architected to emphasize code sharing

Mwai Banda 21 Dec 21, 2022
Add Bubble Navigation Bar in Android Jetpack Compose.

BubbleNavigationBarCompose How it looks Setup Open the file settings.gradle (it looks like that) dependencyResolutionManagement { repositoriesMode

Emir Demirli 11 Jan 5, 2023