给text文本添加颜色渐变使用ShaderMask
_gradientText(text,Alignment begin,Alignment end,colors){
return ShaderMask(
shaderCallback: (rect) {
return LinearGradient(
begin: begin,
end: end,
colors: colors,
).createShader(rect);
},
child: Text(
"$text",
style: TextStyle(
color: Colors.white, fontSize: 64.sp, fontWeight: FontWeight.bold),
),
);
}
//白色到淡黄色渐变:
_gradientText(
'ATUI诚邀您的入驻', Alignment.topCenter, Alignment.bottomCenter, [
Color(0xFFFFFFF1),
Color(0xFFFFFFF1),
Color(0xFFFFEDBE),
Color(0xFFFFEDBE)
])
//半透明色度渐变
_gradientText(
'ATUIATUI', Alignment.topCenter, Alignment.bottomCenter, [
Color(0xFFE5E5E5),
Color(0xFFF8F8F8),
])