Created
May 22, 2022 21:01
-
-
Save jmadaminov/52160fe5c1859d857286a99ab7b031bb to your computer and use it in GitHub Desktop.
Metrics
This file contains hidden or 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
... | |
var screenWidthPx: Int | |
var screenWidthDp: Int | |
var cardWidthPx: Int | |
var cardWidthDp: Int | |
var cardHeightPx: Int | |
val cardHeightDp = 150 | |
var cardMarginPx: Int | |
val cardMarginDp = 15 | |
with(LocalDensity.current) { | |
screenWidthDp = LocalConfiguration.current.screenWidthDp | |
screenWidthPx = screenWidthDp.dp.toPx().toInt() | |
cardWidthPx = screenWidthPx / 2 | |
cardWidthDp = screenWidthDp / 2 | |
cardHeightPx = cardHeightDp.dp.toPx().toInt() | |
cardMarginPx = cardMarginDp.dp.toPx().toInt() | |
} | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment