Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/amirsinarz/lcswitch
Android Jetpack Compose implementation of switch animation from Oleg Frolov
https://github.com/amirsinarz/lcswitch
android compose-ui jetpack-compose kotlin kotlin-android
Last synced: about 2 months ago
JSON representation
Android Jetpack Compose implementation of switch animation from Oleg Frolov
- Host: GitHub
- URL: https://github.com/amirsinarz/lcswitch
- Owner: AmirSinaRZ
- Created: 2024-12-18T05:20:04.000Z (about 2 months ago)
- Default Branch: master
- Last Pushed: 2024-12-18T05:58:27.000Z (about 2 months ago)
- Last Synced: 2024-12-18T06:38:02.602Z (about 2 months ago)
- Topics: android, compose-ui, jetpack-compose, kotlin, kotlin-android
- Language: Kotlin
- Homepage:
- Size: 1.07 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Preview
![]()
LCSwitch
A Circular and Linear toggle switch component built using Jetpack Compose. Inspired by Oleg Frolov
[![Platform](https://img.shields.io/badge/platform-android-green.svg)](http://developer.android.com/index.html)
[![API](https://img.shields.io/badge/API-21%2B-brightgreen.svg?style=flat)](https://android-arsenal.com/api?level=21)USAGE
-----
Just add [LCSwitch.kt](https://github.com/AmirSinaRZ/LCSwitch/blob/master/app/src/main/java/com/amirsinarz/lcswitch/LCSwitch.kt) file in your project .
Examples are in the [MainActivity.kt](https://github.com/AmirSinaRZ/LCSwitch/blob/master/app/src/main/java/com/amirsinarz/lcswitch/MainActivity.kt)### Circular Switch:
```kotlin
@Composable
fun SwitcherC(
modifier: Modifier = Modifier,
width: Dp = 46.dp,
height: Dp = 26.dp,
checked: Boolean = true,
onCheckedChange: ((Boolean) -> Unit)? = null,
elevation: Dp = 4.dp,
onColor: Color = Color(0xFF48ea8b),
offColor: Color = Color(0xFFff4651),
iconColor: Color = Color.White,
)
```
### Linear Switch
```kotlin
@Composable
fun SwitcherL(
modifier: Modifier = Modifier,
width: Dp = 46.dp,
height: Dp = 26.dp,
checked: Boolean = true,
onCheckedChange: ((Boolean) -> Unit)? = null,
elevation: Dp = 4.dp,
onColor: Color = Color(0xFF48ea8b),
offColor: Color = Color(0xFFff4651),
iconColor: Color = Color.White,
)
```