Will ShaderMask uses more CPU?

Viewed 26

I have used ShaderMask for implementing gradient on images. But after using this, the page is taking more time to load. Also the app got crashes several times. I used ShaderMask so that I can layer text over the image.

This was the code:

ShaderMask(
                shaderCallback: (rect) {
                  return LinearGradient(
                    begin: Alignment.topCenter,
                    end: Alignment.bottomCenter,
                    colors: [gradientStart, gradientEnd],
                  ).createShader(rect);
                },
                blendMode: BlendMode.srcATop,
                child: ClipRRect(
                  borderRadius: BorderRadius.circular(16),
                  child: Container(
                    decoration: BoxDecoration(
                      borderRadius: BorderRadius.circular(16),
                      image: DecorationImage(
                        image: AssetImage(imageLink),
                        fit: BoxFit.cover,
                      ),
                      boxShadow: <BoxShadow>[
                        BoxShadow(color: Colors.grey.withOpacity(0.6), blurRadius: 24),
                      ],
                    ),
                  ),
                ),
              ),
0 Answers
Related