Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/theapache64/twyper
๐ฅ Yet another Tinder like swipeable cards, built for Jetpack Compose
https://github.com/theapache64/twyper
jetpack-compose tinder-swiper
Last synced: about 2 months ago
JSON representation
๐ฅ Yet another Tinder like swipeable cards, built for Jetpack Compose
- Host: GitHub
- URL: https://github.com/theapache64/twyper
- Owner: theapache64
- Created: 2022-02-20T16:58:45.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2022-08-01T18:48:40.000Z (over 2 years ago)
- Last Synced: 2024-05-01T15:33:23.849Z (9 months ago)
- Topics: jetpack-compose, tinder-swiper
- Language: Kotlin
- Homepage: https://twitter.com/theapache64/status/1495460911372705793
- Size: 200 KB
- Stars: 105
- Watchers: 2
- Forks: 7
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
![](cover.jpeg)
# twyper
![buildStatus](https://img.shields.io/github/workflow/status/theapache64/twyper/Java%20CI%20with%20Gradle?style=plastic)
![latestVersion](https://img.shields.io/github/v/release/theapache64/twyper)
> Yet another Tinder like swipeable card library, built for Jetpack Compose
### โจ Demo
https://user-images.githubusercontent.com/9678279/154856283-c38be412-387c-4b25-a612-01fea39829f1.mov
## โจ๏ธ Usage
![latestVersion](https://img.shields.io/github/v/release/theapache64/twyper)
### 1. Add dependency
```groovy
repositories {
maven { url 'https://jitpack.io' } // Add jitpack
}dependencies {
implementation 'com.github.theapache64:twyper:'
}
```### 2. Use `Twyper` composable
```kotlin
val items = remember { mutableStateListOf(*('A'..'Z').toList().toTypedArray()) }// twyperController to swipe cards programmatically
val twyperController = rememberTwyperController()
Twyper(
items = items,
twyperController = twyperController, // optional
onItemRemoved = { item, direction ->
println("Item removed: $item -> $direction")
items.remove(item)
},
onEmpty = { // invoked when the stack is empty
println("End reached")
}
) { item ->
// card content goes here
}```
- See full source code [here](https://github.com/theapache64/twyper/blob/b4c21e76928ed888c9c1230ca9e3ac4711d8cf5a/sample/src/main/java/com/github/theapache64/twyper/TwyperPreview.kt#L20)### 3. Use `TwyperFlip` composable
```kotlin
val items = remember { mutableStateListOf(*('A'..'Z').toList().toTypedArray()) }// twyperFlipController to swipe cards programmatically
val twyperFlipController = rememberTwyperFlipController()val generateBoxModifier: () -> Modifier = {
//return Modifier for the card
}TwyperFlip(
items = items,
twyperFlipController = twyperFlipController,
onItemRemoved = { item, direction ->
println("Item removed: $item -> $direction")
items.remove(item)
},
cardModifier = generateBoxModifier,
onEmpty = {
println("End reached")
},
front = { item ->
// card content goes here
},
back = { item ->
// card content when flipped goes here
})
```
- See full source code [here](https://github.com/yash-k9/twyper/blob/master/sample/src/main/java/com/github/theapache64/twyper/TwyperFlipPreview.kt)## ๐งช More Samples
- [Swipe Search](https://github.com/theapache64/swipe-search)
https://user-images.githubusercontent.com/9678279/154852171-184ff026-f2e4-4ff7-9782-4ab3d9947bf7.mov
- [Swipe Search Flip](https://github.com/theapache64/swipe-search)
https://user-images.githubusercontent.com/59912430/157506600-6fc784c7-e7f5-40ae-b6fe-d369876e7908.mp4
- [TwyperFlip Demo](https://github.com/yash-k9/twyper/blob/master/sample/src/main/java/com/github/theapache64/twyper/TwyperFlipPreview.kt)
https://user-images.githubusercontent.com/59912430/157507083-77e646d6-e735-4227-abb6-f13c56e217dc.mp4
## โ๏ธ Author
๐ค **theapache64**
* Twitter: @theapache64
* Email: [email protected]Feel free to ping me ๐
## ๐ค Contributing
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any
contributions you make are **greatly appreciated**.1. Open an issue first to discuss what you would like to change.
1. Fork the Project
1. Create your feature branch (`git checkout -b feature/amazing-feature`)
1. Commit your changes (`git commit -m 'Add some amazing feature'`)
1. Push to the branch (`git push origin feature/amazing-feature`)
1. Open a pull requestPlease make sure to update tests as appropriate.
## โค Show your support
Give a โญ๏ธ if this project helped you!
## โ๏ธ TODO
- [ ] Add UI tests and unit tests
## ๐ License
```
Copyright ยฉ 2022 - theapache64Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```_This README was generated by [readgen](https://github.com/theapache64/readgen)_ โค