您可以使用ShaderMask
有渐变。
您可以在里面调整LinearGradient
the stops
和colors
来改变效果。
也许改变Colors.white
to Colors.trasnparent
请尝试一下这段代码,看看有什么效果。
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: ShaderMask(
shaderCallback: (Rect bounds) {
return LinearGradient(
colors: [Colors.white, Colors.white.withOpacity(0.05)],
stops: [0.7, 1],
tileMode: TileMode.mirror,
).createShader(bounds);
},
child: Container(
height: 100,
child: ListView(
scrollDirection: Axis.horizontal,
children: <Widget>[
Card(
color: Colors.red,
child: Center(child: Text("012345678910 - 0123")),
),
Card(
color: Colors.yellow,
child: Center(child: Text("012345678910 - 0123")),
),
Card(
color: Colors.blue,
child: Center(child: Text("012345678910 - 0123")),
),
],
),
),
),
),
);
}
这些是图像中的示例:
![enter image description here](https://i.stack.imgur.com/wBkx4.png)
![enter image description here](https://i.stack.imgur.com/Ge0LH.png)
![enter image description here](https://i.stack.imgur.com/3kGhS.png)