Skip to content

Instantly share code, notes, and snippets.

View pranaypatel512's full-sized avatar
😎
Working...

pRaNaY pranaypatel512

😎
Working...
View GitHub Profile
@pranaypatel512
pranaypatel512 / Githookblogreference.kt
Created May 19, 2023 08:44
Githook blog reference
import io.gitlab.arturbosch.detekt.Detekt
plugins {
// this is necessary to avoid the plugins to be loaded multiple times
// in each subproject's classloader
// ===== Other main pluging of project ====
id("org.jlleitschuh.gradle.ktlint").apply(false) // https://github.com/jlleitschuh/ktlint-gradle
id("io.gitlab.arturbosch.detekt").apply(false) // https://github.com/detekt/detekt
@pranaypatel512
pranaypatel512 / DifferentLocaleComposablePreview
Created October 29, 2022 12:37
DifferentLocaleComposablePreview
@Preview(locale = "fr-rFR")
@Composable
fun DifferentLocaleComposablePreview() {
Text(text = stringResource(R.string.greetings))
}
// Step 1: Create
@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES)
@OtherMultipreview1
@OtherMultipreview2
@DevicePreviews
annotation class AllPreviews
// Step 2: User AllPreviews
@pranaypatel512
pranaypatel512 / DevicePreviews
Created October 29, 2022 11:48
DevicePreviews
@DevicePreviews
@Composable
fun WelcomeScreenPreview() {
MyAppTheme() {
Surface() {
WelcomeScreen()
}
}
}
@pranaypatel512
pranaypatel512 / Multipreview
Created October 29, 2022 11:42
Multipreview
/**
* Multipreview annotation that represents various device sizes. Add this annotation to a composable
* to render various devices.
*/
@Preview(showSystemUi = true, device = "spec:width=411dp,height=891dp", name = "Phone")
@Preview(showSystemUi = true, device = "spec:width=673.5dp,height=841dp,dpi=480", name = "Foldable")
@Preview(showSystemUi = true, device = "spec:width=1280dp,height=800dp,dpi=480", name = "Tablet")
@Preview(showSystemUi = true, device = "spec:width=1920dp,height=1080dp,dpi=480", name = "Desktop")
annotation class DevicePreviews
@pranaypatel512
pranaypatel512 / WelcomeScreenPreviewBG
Created October 29, 2022 11:23
WelcomeScreenPreviewBG
@Preview(showSystemUi = true, showBackground = true, backgroundColor = 0xFFE1E2EC)
@Composable
fun WelcomeScreenPreview() {
MyAppTheme {
Surface {
WelcomeScreen()
}
}
}
@pranaypatel512
pranaypatel512 / WelcomeScreenPreview
Created October 29, 2022 11:15
WelcomeScreenPreview
@Preview(showSystemUi = true, device = "spec:width=411dp,height=891dp")
@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES)
// @Preview(showSystemUi = true, device = "spec:width=673.5dp,height=841dp,dpi=480")
// @Preview(showSystemUi = true, device = "spec:width=1280dp,height=800dp,dpi=480")
// @Preview(showSystemUi = true, device = "spec:width=1920dp,height=1080dp,dpi=480")
@Composable
fun WelcomeScreenPreview() {
MyAppTheme() {
Surface() {
WelcomeScreen()
@pranaypatel512
pranaypatel512 / JetKiteButtonPreview
Created October 29, 2022 11:03
JetKiteButtonPreview
@Composable
@Preview(name = "Light")
@Preview(name = "Dark", uiMode = Configuration.UI_MODE_NIGHT_YES)
fun JetKiteButtonPreview() {
JetKiteTheme {
Surface {
JetKiteButton(text = "Login") {
}
}
}
@pranaypatel512
pranaypatel512 / JetKiteButtonPreview
Last active October 29, 2022 11:00
JetKiteButtonPreview
@Composable
@Preview
fun JetKiteButtonPreview() {
JetKiteTheme {
Surface {
JetKiteButton(text = "Login") {
}
}
}
}
@pranaypatel512
pranaypatel512 / JetKiteButton
Last active October 29, 2022 10:56
JetKiteButton
@Composable
fun JetKiteButton(
modifier: Modifier = Modifier,
text: String,
enabled: Boolean = true,
onClick: () -> Unit
) {
Button(
modifier = modifier
.fillMaxWidth(),