https://github.com/mejdi14/lean-dialog
https://github.com/mejdi14/lean-dialog
Last synced: 7 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/mejdi14/lean-dialog
- Owner: mejdi14
- Created: 2023-05-26T12:26:47.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-10-08T23:33:31.000Z (almost 2 years ago)
- Last Synced: 2025-01-11T03:27:42.864Z (9 months ago)
- Language: Kotlin
- Size: 209 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Welcome to Lean Dialog Library 👋
## ✨ Demo
![]()
## :art:Design inspiration
many thanks goes to [Sergey](https://dribbble.com/churumovsergey) for the beautiful design and animation## Installation
Add this in your root `build.gradle` file (**not** your module `build.gradle` file):
```gradle
allprojects {
repositories {
...
maven { url "https://jitpack.io" }
}
}
```
## :hammer:DependencyAdd this to your module's `build.gradle` file (make sure the version matches the JitPack badge above):
```gradle
dependencies {
...
implementation 'com.github.mejdi14:Lean-Dialog:0.0.1'
}
```## :fire:How to use
``` java
val showDialog = remember { mutableStateOf(false) }val alphaAnimation by animateFloatAsState(
targetValue = if (showDialog.value) 1f else 0f, label = ""
)val offsetAnimation by animateDpAsState(
targetValue = if (showDialog.value) 0.dp else (DialogAnimation.BottomToCenter.value).dp,
animationSpec = spring(stiffness = Spring.StiffnessVeryLow), label = ""
)Button(onClick = { showDialog.value = true }) {
Text("Show Dialog")
}if (showDialog.value) {
LeanOverlay(showDialog, offsetAnimation, alphaAnimation, modifier = Modifier.width(300.dp)
.height(200.dp), dismissOnClickOutside = true){
BodyContentExample()
}
}
```Animation direction
-----``` java
DialogAnimation.TopToCenter
DialogAnimation.BottomToCenter
DialogAnimation.LeftToRight
DialogAnimation.RightToLeft
DialogAnimation.NONE
```BorderLineCanvasParams
-----``` java
val color: Color = Color.White,
val topLeft: Offset = Offset.Zero,
val cornerRadius: CornerRadius = CornerRadius(10f, 10f),
val strokeWidth: Float = 2f
```
MainCardParams
-----``` java
val backgroundColor: Color = Color.White,
val roundedCornerShape: RoundedCornerShape = RoundedCornerShape(10.dp),
val rotationAngle : Float = -4f
```## 🤝 Contributing
Contributions, issues and feature requests are welcome.
Feel free to check [issues page] if you want to contribute.## Author
👤 **Mejdi Hafiane**
- profile: [@MejdiHafiane](https://twitter.com/mejdi141)
## Show your support
Please ⭐️ this repository if this project helped you!