DraggableScaffold

Additional

Language
Kotlin
Version
1.2.1 (Sep 30, 2021)
Created
Jun 8, 2021
Updated
Sep 30, 2021 (Retired)
Owner
Tiago Araujo (Tgo1014)
Contributors
Roman Levinzon (levinzonr)
Tiago Araujo (Tgo1014)
2
Activity
Badge
Generate
Download
Source code

Commercial

DraggableScaffold

DraggableScaffold is a library that helps stack one composable on top of another so it can be dragged to reveal the content under it.

Current Compose Version: 1.0.2

Demo

To see the code for the examples in the gif you can check here.

Basic use

DraggableScaffold(
  contentUnderRight = { Text(text = "Hello ????", Modifier.padding(4.dp)) },
  contentOnTop = {
    Card(
      modifier = Modifier.padding(4.dp).fillMaxWidth(),
      elevation = 4.dp
     { Text(text = "Drag this to show content on the right", Modifier.padding(16.dp)) }
  }
)

Adding to your porject

1 - Add it in your root build.gradle at the end of repositories:

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

2 - Add the dependency:

dependencies {
  ...
  implementation "com.github.Tgo1014:DraggableScaffold:1.2.1"
  ...
}