compose-shimmer icon indicating copy to clipboard operation
compose-shimmer copied to clipboard

how to implement enable or disable shimmer

Open aisatriani opened this issue 2 years ago • 3 comments

aisatriani avatar Oct 07 '23 16:10 aisatriani

Check this for enable/disable: https://github.com/valentinilk/compose-shimmer/issues/7

TamasRusvai avatar Nov 06 '23 11:11 TamasRusvai

Well going through the Readme file, I too had the same question. I feel the example in the "Quick Start" section is very confusing. I feel it should be more simple. I think giving a sample of how to achevie the intro gif will make understanding how to use lot more easier.

If we agree, I can raise a PR.

saran2020 avatar Jun 26 '24 14:06 saran2020

I think you can do "intro gif" easily, you should set background gray, and use shimmer modifier.

you can enable or disable like below.

`

val showShimmer by remember {
    mutableStateOf(true)
}
Box(
    modifier = Modifier
        .size(50.dp)
        .background(Color.LightGray)
        .shimmer(showShimmer)
) {

}

`

@Composable fun Modifier.shimmer(show: Boolean) = this then Modifier.apply { if (show) shimmer() }

ocetin00 avatar Sep 26 '24 09:09 ocetin00