Flutter 三维容器颤振中的梯度效应
如何装饰容器这样的效果。我试着使用梯度,但我不知道如何使水平梯度如图所示。 非常感谢您提供的任何帮助或资源。尝试以下方法:Flutter 三维容器颤振中的梯度效应,flutter,flutter-layout,Flutter,Flutter Layout,如何装饰容器这样的效果。我试着使用梯度,但我不知道如何使水平梯度如图所示。 非常感谢您提供的任何帮助或资源。尝试以下方法: Container( height: 100, decoration: BoxDecoration( gradient: LinearGradient( colors: [ Colors.black, Colors.purple,
Container(
height: 100,
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
Colors.black,
Colors.purple,
Colors.blue,
Colors.green,
Colors.brown,
],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
stops: [0.01, 0.3, 0.4, 0.8, 1],
),
),
)
您已经有了颜色,您必须创建停止
,这在我的示例中是不言自明的,并且必须与颜色具有相同的长度
如果要使其水平,请调整开始
和结束
参数。尝试以下操作:
Container(
height: 100,
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
Colors.black,
Colors.purple,
Colors.blue,
Colors.green,
Colors.brown,
],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
stops: [0.01, 0.3, 0.4, 0.8, 1],
),
),
)
您已经有了颜色,您必须创建停止
,这在我的示例中是不言自明的,并且必须与颜色具有相同的长度
如果要使其水平,请调整begin
和end
参数