Skip to content

Conversation

@XDdevv
Copy link
Contributor

@XDdevv XDdevv commented Aug 22, 2025

🚀 Add Vertical Orientation to SlideToUnlock

🎯 Goal

Enhance SlideToUnlock by adding vertical orientation support, making it more flexible for different UI layouts.
Currently, the component only supports horizontal sliding. With this update, developers can also enable vertical sliding, which is especially useful for:

  • Compact UIs
  • Bottom sheets
  • Narrow or tall layouts

🛠 Implementation Details

  • ✨ Added a new parameter:
    orientation: SlideOrientation = SlideOrientation.Horizontal
  • 🔄 Implemented proper gesture detection for vertical sliding.
  • 📐 Updated layout measurement & track rendering to support both orientations.
  • 🖌 Ensured thumb and hint composables remain aligned and styled correctly in vertical mode.
  • 🔒 Maintains backward compatibility with existing horizontal behavior.

✍️ Examples

Horizontal (default):

SlideToUnlock(
    isSlided = isSlided,
    onSlideCompleted = { isSlided = true },
    hintTexts = HintTexts(
        defaultText = "Slide to subscribe",
        slidedText = "Subscribing..."
    )
)

Vertical (new):

SlideToUnlock(
    isSlided = isSlided,
    orientation = SlideOrientation.Vertical,
    modifier = Modifier.height(300.dp),
    onSlideCompleted = { isSlided = true },
    hintTexts = HintTexts(
        defaultText = "Swipe down to confirm",
        slidedText = "Confirming..."
    )
)

✅ Prepare for Review

  • Ran ./gradlew spotlessApply → ✅ Clean formatting
  • Ran ./gradlew apiDump → ✅ Verified no unintended API changes
  • Tested both orientations in the sample app

@XDdevv XDdevv requested a review from skydoves as a code owner August 22, 2025 10:10
Copy link
Member

@skydoves skydoves left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome! Thank you so much for your contribution 💙

@skydoves skydoves merged commit dc87632 into RevenueCat:main Aug 22, 2025
3 checks passed
@XDdevv
Copy link
Contributor Author

XDdevv commented Aug 22, 2025

Thanks for the quick review and merge! Really happy to contribute to this project 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants