Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gradient color to stars?? #74

Open
flutterdev97 opened this issue Sep 27, 2021 · 1 comment
Open

gradient color to stars?? #74

flutterdev97 opened this issue Sep 27, 2021 · 1 comment

Comments

@flutterdev97
Copy link

How can we give gradient color to stars??

@LukeMoody01
Copy link

Hey @flutterdev97,

You can accomplish this by wrapping your widget within a ShaderMask.

RatingBar(
    ratingWidget: RatingWidget(
    full: ShaderMask(
        blendMode: BlendMode.srcIn,
        shaderCallback: (bounds) {
            return const LinearGradient(
                begin: Alignment.bottomCenter,
                end: Alignment.topCenter,
                colors: [
                    Color.fromARGB(255, 255, 238, 0), 
                    Color.fromARGB(255, 224, 75, 100),
                ],
               ).createShader(
                 Rect.fromLTWH(0, 0, bounds.width, bounds.height),
               );
             },
        child: _image('assets/heart.png'),
        ),
    half: ...
    empty: ...
    ),
);

image

Hope this helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants