原图
Screenshot_1611882540.png
渐变后
Screenshot_1611882430.png
代码
代码语言:javascript复制@override
Widget build(BuildContext context) {
return Stack(
children: <Widget>[
Container(
height: ScreenAdaper.screenHeight(),
width: ScreenAdaper.screenWidth(),
child: CachedNetworkImage(
imageUrl: GetSafeValue.getSafeString(
'https://gimg2.baidu.com/image_search/src=http://5b0988e595225.cdn.sohucs.com/images/20181011/97d76bbdd19c4fc9a22e11bb5ce643cc.jpeg&refer=http://5b0988e595225.cdn.sohucs.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1614474338&t=14fa75e89ec904eba38aca324bf4535e'),
fit: BoxFit.cover,
),
),
new Container(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
Colors.transparent,
Colors.white.withOpacity(0.1),
Colors.white.withOpacity(0.1),
Colors.white.withOpacity(0.1),
Colors.white.withOpacity(0.2),
Colors.white.withOpacity(0.6),
Colors.white.withOpacity(0.7),
Colors.white.withOpacity(0.8),
Colors.white.withOpacity(0.9),
Colors.white.withOpacity(1.0),
Colors.white.withOpacity(1.0),
Colors.white.withOpacity(1.0),
Colors.white.withOpacity(1.0),
],
),
),
),
],
);
}