我该如何说出带有阴影的容器(如所附图片)?
我不仅使用图像,因为要对其进行小的更改会更加困难,并且颜色有时需要是整个屏幕的宽度,也许我要对其进行动画处理。
您可以使用的gradient
属性BoxDecoration
来获取所需的内容。
我添加了一个演示:
class StackOver extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
// use your preferred colors
Colors.red[900],
Colors.blue[900],
],
// start at the top
begin: Alignment.topCenter,
// end at the bottom
end: Alignment.bottomCenter,
),
),
),
);
}
}
结果:
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句