I want to set a gradient as a background color for my ElevatedButton.
So I did this :
Container(
height: 100,
width: 100,
decoration: const BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topRight,
end: Alignment.bottomLeft,
colors: [
Color(0xFFFE1871),
Color(0xFFFD0E38),
Color(0xFFFF0205),
],
)),
child: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: Colors.transparent),
onPressed: () {},
child: const Text(
'S'inscrire',
)),
),
But the gradient’s colors are darker than expected.
Here’s what I want :
Here’s what I have :
It seems like there is some default opacity with Colors.transparent.
How to fix it ?
3
Answers
Add shadowColor
it’s shadowColor
its work for me below is the code and screenshot
I know this might not be the best solution but you can try with this