Skip to content

SDP-Compose: a scalable size unit for Jetpack Compose

Notifications You must be signed in to change notification settings

Kaaveh/sdp-compose

Repository files navigation

SDP-Compose: a scalable size unit for Jetpack Compose

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!

Usage

@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,
        )

Setup

  1. Add it in your setting.gradle at the end of repositories:
dependencyResolutionManagement {
	repositories {
		...
		maven { url 'https://jitpack.io' }
	}
}
  1. Add the dependency
dependencies {
	implementation 'com.github.Kaaveh:sdp-compose:1.1.0'
}
  1. Enjoy!

About

SDP-Compose: a scalable size unit for Jetpack Compose

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages