-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit ef8f88b
Showing
14 changed files
with
619 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
.gradle | ||
build/ | ||
!gradle/wrapper/gradle-wrapper.jar | ||
!**/src/main/**/build/ | ||
!**/src/test/**/build/ | ||
local.properties | ||
|
||
### IntelliJ IDEA ### | ||
.idea | ||
*.iws | ||
*.iml | ||
*.ipr | ||
out/ | ||
!**/src/main/**/out/ | ||
!**/src/test/**/out/ | ||
|
||
### Eclipse ### | ||
.apt_generated | ||
.classpath | ||
.factorypath | ||
.project | ||
.settings | ||
.springBeans | ||
.sts4-cache | ||
bin/ | ||
!**/src/main/**/bin/ | ||
!**/src/test/**/bin/ | ||
|
||
### NetBeans ### | ||
/nbproject/private/ | ||
/nbbuild/ | ||
/dist/ | ||
/nbdist/ | ||
/.nb-gradle/ | ||
|
||
### VS Code ### | ||
.vscode/ | ||
|
||
### Mac OS ### | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 iamcalledrob | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# smoothRoundedCornerShape | ||
|
||
## Introduction | ||
Kotlin Multiplatform library that provides `SmoothRoundedCornerShape` -- which works just like `RoundedCornerShape`, | ||
but takes an additional `smoothing` parameter. | ||
|
||
The `smoothing` value approximately maps to Figma's corner smoothing setting as a fraction, for example | ||
`smoothing: 0.6f` is roughly equivalent to Figma's `Corner smoothing: 60%` | ||
|
||
|
||
There is no path/smoothing logic contained in this library, it's just a lightweight binding on top of [androidx.graphics.shapes](https://developer.android.com/reference/kotlin/androidx/graphics/shapes/package-summary) | ||
|
||
## Installation | ||
Add the [jitpack](https://jitpack.io/) repository to your build file: | ||
```kotlin | ||
repositories { | ||
maven { url 'https://jitpack.io' } | ||
} | ||
``` | ||
|
||
Then add as a module dependency: | ||
```kotlin | ||
dependencies { | ||
implementation("com.github.iamcalledrob:smoothRoundedCornerShape:1.0.0") | ||
} | ||
``` | ||
|
||
## Usage | ||
Use in place of `RoundedCornerShape` for example: | ||
```kotlin | ||
val shape = SmoothRoundedCornerShape(smoothing = 0.6f, radius = 10.dp) | ||
Box(Modifier.background(Color.Red, shape = shape).width(128.dp).height(64.dp)) | ||
``` | ||
|
||
|
||
## Notes | ||
Currently only builds desktop (jvm) and android targets, since only those have been tested. Feel free to make a PR for | ||
other platforms. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
plugins { | ||
kotlin("multiplatform") version "1.9.23" | ||
id("org.jetbrains.compose") version "1.6.11" | ||
id("com.android.library") version "8.2.0" | ||
id("maven-publish") | ||
} | ||
|
||
group = "com.github.iamcalledrob" | ||
version = "1.0.0" | ||
|
||
repositories { | ||
mavenCentral() | ||
google() | ||
} | ||
|
||
|
||
kotlin { | ||
jvmToolchain(17) | ||
|
||
jvm("desktop") | ||
|
||
androidTarget { | ||
publishLibraryVariants("release", "debug") | ||
} | ||
|
||
sourceSets { | ||
commonMain { | ||
dependencies { | ||
implementation("androidx.graphics:graphics-shapes:1.0.1") | ||
|
||
implementation(compose.runtime) | ||
implementation(compose.foundation) | ||
implementation(compose.ui) | ||
} | ||
} | ||
} | ||
} | ||
|
||
android { | ||
namespace = "com.github.iamcalledrob.smoothRoundedCornerShape" | ||
compileSdk = 34 | ||
} | ||
|
||
publishing { | ||
publications { | ||
create<MavenPublication>("maven") { | ||
from(components["kotlin"]) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
kotlin.code.style=official | ||
android.useAndroidX=true |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#Thu Sep 05 13:18:42 BST 2024 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Oops, something went wrong.