Do you miss SDP library from XML world? SDP-Compose bring to you SDP in your Jetpack Compose project.
Bonus: You don't need SSP library, SDP-Compose have it too!
@Preview(showBackground = true)
@Composable
fun Greeting(name: String = "Android") {
Text(
text = "Hello $name!",
color = Color.White,
fontSize = 16.ssp,
modifier = Modifier
.fillMaxWidth()
.padding(16.sdp)
.clip(RoundedCornerShape(16.sdp))
.background(Teal200)
.padding(16.sdp),
)
}
For using in non-Composable functions like in typography:
val TextSmall: TextStyle
@Composable get() =
TextStyle(
fontFamily = yekanRegularFont,
fontSize = 12.ssp,
)
- Add it in your setting.gradle at the end of repositories:
dependencyResolutionManagement {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
- Add the dependency
dependencies {
implementation 'com.github.Kaaveh:sdp-compose:1.1.0'
}
- Enjoy!