您需要一个
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混合模式下从顶部到底部淡出图像
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)