我在影像上應用線性漸變,但漸變過渡不平滑。請看下圖。

漸變結束時有一條線。如何在漸變上平滑過渡。
Container(
height: 350,
decoration: BoxDecoration(
borderRadius: const BorderRadius.all(Radius.circular(25)),
boxShadow: const [BoxShadow(color: Color.fromRGBO(104, 104, 104, 0.2), offset: Offset(0, 1), spreadRadius: 5, blurRadius: 10)],
image: DecorationImage(
image: getImage(imageno: 123).image,
fit: BoxFit.cover,
),
),
),
Positioned(
bottom: 0,
left: 0,
right: 0,
child: Container(
height: 225,
foregroundDecoration: const BoxDecoration(
borderRadius: BorderRadius.only(bottomLeft: Radius.circular(25.0), bottomRight: Radius.circular(25.0)),
gradient: LinearGradient(
colors: [
Color.fromRGBO(0, 0, 0, 0),
Color.fromRGBO(0, 0, 0, 0.65),
Color.fromRGBO(22, 22, 22, 0.81),
],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
stops: [0, 0.3, 0.1],
),
),
),
),
)
uj5u.com熱心網友回復:
這是因為您的stops,它應該是您的停靠點的行內更改,您的最后一個停靠點比中間停靠點小,這就是問題所在,將其更改為:
stops: [0, 0.6, 1],
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/526461.html
標籤:扑线性梯度颤动图像
上一篇:如何在顫動的影像上應用漸變顏色
