From 8c32d836d1980a1356db6aec1223ab8fd2b029b0 Mon Sep 17 00:00:00 2001 From: irealsp <115007789+irealsp@users.noreply.github.com> Date: Tue, 4 Oct 2022 18:56:30 +0530 Subject: [PATCH 1/3] Create README.md --- README.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..c36bd52 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# compose-pixelperfectdesign From bd10f93c37189d1b6a107a57be82101cb352ca58 Mon Sep 17 00:00:00 2001 From: irealsp <115007789+irealsp@users.noreply.github.com> Date: Tue, 4 Oct 2022 22:43:40 +0530 Subject: [PATCH 2/3] Update README file --- README.md | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/README.md b/README.md index c36bd52..d824d68 100644 --- a/README.md +++ b/README.md @@ -1 +1,49 @@ # compose-pixelperfectdesign +To make percentile design in kotlin. This lib Will Help you. + +### Pixel Perfect Design is a fase and efficient open source constant management That use for create Percentage wise design. so any size of device it's look Same. + +## Dependency +Step 1. Add it in your root build.gradle at the end of repositories: +``` +allprojects { + repositories { + ... + maven { url 'https://jitpack.io' } + } +} +``` +Step 2. Add the dependency +``` +dependencies { + implementation 'com.github.irealsp:compose-pixelperfectdesign:0.1.0' +} +``` + +## About +The library allows you to use use the device Width and Height as measuring units, that can be used to set the Modifier properties. The advantages of using dw(device width), dh (device height) values instead of dp is that you can scale the content of the Composable components according to the current device size. + +To initialize the size inside your MainActivity onCreate method call the method initSize(), otherwise you would get an java.lang.IllegalArgumentException: Cannot round NaN value. error! +``` +class MainActivity : ComponentActivity() { + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + + // init device width and height + initSize() + + setContent { + + // your UI here + Text( + text = "Hello", + fontSize = 0.04.sh, + color = Color.Green, + modifier = Modifier + .offset(x = 0.07.dw, y = 0.2.dh) + ) + } + } +} +``` From 89306b668e022cb0c1083c47c5406b7821587914 Mon Sep 17 00:00:00 2001 From: irealsp <115007789+irealsp@users.noreply.github.com> Date: Tue, 4 Oct 2022 22:52:10 +0530 Subject: [PATCH 3/3] update .gitignore --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index aa724b7..603b140 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,3 @@ /captures .externalNativeBuild .cxx -local.properties