Git Product home page Git Product logo

Comments (2)

FernandoCCNunes avatar FernandoCCNunes commented on July 29, 2024 2

It did work.

I appreciate your time and your work.

from compose-shimmer.

valentinilk avatar valentinilk commented on July 29, 2024

Hello @FernandoCCNunes,

the effect is ignoring your custom theme, because the theme is only provided after the shimmer was already created.

A bit of an insight. The shimmer() modifier calls rememberShimmer for you, if you don't provide a shimmer already as a parameter.

rememberShimmer itself calls LocalShimmerTheme.current and creates a shimmer effect, based on the theme it can find.

So if you just move your rememberShimmer into the scope of the CompositonLocalProvider, it will work.

CompositionLocalProvider(
    LocalShimmerTheme provides shimmerTheme
 ) {

    val shimmer =  rememberShimmer(shimmerBounds = ShimmerBounds.Window)

     Card(
        modifier = modifier
            .shimmer(shimmer),
        elevation = elevation,
        backgroundColor = color,
    ) {}
}

Ideally you would provide the shimmer theme only once in your application, or once for each ComposeView you are using. So directly after applying the MaterialTheme.

Let me know if it works :) and thank you for using the library.

from compose-shimmer.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.