Giter VIP home page Giter VIP logo

twyper's Introduction

twyper

buildStatus latestVersion Twitter: theapache64

Yet another Tinder like swipeable card library, built for Jetpack Compose

✨ Demo

Screen.Recording.2022-02-20.at.10.46.59.PM.mov

⌨️ Usage

latestVersion

1. Add dependency

repositories {
  maven { url 'https://jitpack.io' } // Add jitpack
}

dependencies {
  implementation 'com.github.theapache64:twyper:<latest.version>'
}

2. Use Twyper composable

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

3. Use TwyperFlip composable

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

🧪 More Samples

Screen.Recording.2022-02-20.at.9.36.10.PM.mov
swipe-search.SearchScreen.kt.swipe-search.app.2022-03-09.23-46-00_Trim.mp4
twyper.MainActivity.kt.twyper.sample.2022-02-25.23-57-21_Trim.mp4

✍️ Author

👤 theapache64

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.
  2. Fork the Project
  3. Create your feature branch (git checkout -b feature/amazing-feature)
  4. Commit your changes (git commit -m 'Add some amazing feature')
  5. Push to the branch (git push origin feature/amazing-feature)
  6. Open a pull request

Please make sure to update tests as appropriate.

❤ Show your support

Give a ⭐️ if this project helped you!

Patron Link Buy Me A Coffee

☑️ TODO

  • Add UI tests and unit tests

📝 License

Copyright © 2022 - theapache64

Licensed 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 at

   http://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

twyper's People

Contributors

mertceyhan avatar theapache64 avatar yash-k9 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

twyper's Issues

Update release to include latest features

Problem: Missing features

I'm trying to use the stack count and paddingBetweenCards as parameter, but this PR is not included in the built version #1

It's also is not included in the available release on Github and jitpack.io

Adding Alpha as you swipe

Is it good to have alpha as well when we drag the card?

Something like

   override val alphaValue: Float
    get() =   1 - (abs(swipeX.value)/ (screenWidth/2))

and

.graphicsLayer(alpha = cardController.alphaValue,

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.