here is the example out put i want
here is what i tried
const CircleAvatar(
maxRadius: 40,
backgroundColor: AppColor.pink,
child: CircleAvatar(
maxRadius: 38,
backgroundColor: Colors.white,
child: Icon(
CupertinoIcons.heart_fill,
size: 50,
color: AppColor.pink,
),
),
)
but this is just normal color, there is no option to set gradient color in CircleAvatar
, i looked over all solution, but i couldn’t find a proper solution yet,
thanks for your time
2
Answers
You can create a class and use it as you like
see below example for your understanding
Create a separate file for this class
Note that this will give you gradient colors for icons
Then use it in you widget tree like
Try this code:
Output:
Wrap the CircleAvatar in a Container with a gradient property to create the gradient border effect, and wrap the Icon with a ShaderMask and set its shaderCallback property to a LinearGradient to apply the gradient effect to the icon.
I Hope this help!