颤动的图像在底部淡出(渐变)

颤动的图像在底部淡出(渐变),第1张

颤动的图像在底部淡出渐变

您需要一个

ShaderMask
,例如:

ShaderMask(  shaderCallback: (rect) {    return LinearGradient(      begin: Alignment.topCenter,      end: Alignment.bottomCenter,      colors: [Colors.black, Colors.transparent],    ).createShader(Rect.fromLTRB(0, 0, rect.width, rect.height));  },  blendMode: BlendMode.dstIn,  child: Image.asset(    'assets/chrome.png',    height: 400,    fit: BoxFit.contain,  ),),

这里

shaderCallback
用于返回用作蒙版​​的线性渐变,并在
BlendMode.dstIn
混合模式下从顶部到底部淡出图像



欢迎分享,转载请注明来源:内存溢出

原文地址: https://www.outofmemory.cn/zaji/5090672.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-11-16
下一篇 2022-11-16

发表评论

登录后才能评论

评论列表(0条)

保存