Skip to content

Latest commit

 

History

History
57 lines (48 loc) · 1.3 KB

README.md

File metadata and controls

57 lines (48 loc) · 1.3 KB

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!