I needed the rounded circle icon with two parts ,with different colors.
I tried using a ShadeMask my try seems very off.
Note: I don't need a a gradient just one part a color and the other another color
class HalfFilledIcon extends StatelessWidget {
HalfFilledIcon(
this.icon,
this.size,
this.gradient,
);
final IconData icon;
final double size;
final Gradient gradient;
@override
Widget build(BuildContext context) {
return ShaderMask(
child: SizedBox(
width: size,
height: size,
child: Icon(
icon,
size: size,
color: Colors.grey[300],
),
),
shaderCallback: (Rect bounds) {
final Rect rect = Rect.fromLTRB(0, 0, size / 2, 0);
return gradient.createShader(rect);
},
);
}
}

