Flutter中未定义命名参数“ colors”

时间:2020-10-10 06:50:08

标签: flutter dart colors linear-gradients flutter-upgrade

最近我升级了flutter SDK,然后升级了LinearGradientRadialGradient 正在显示带有命名参数stopscolorstileMode的错误。

错误是

The named parameter 'stops' isn't defined.
The named parameter 'colors' isn't defined.

我的代码是

RadialGradient(
  radius: 0.5,
  colors: [Colors.deepPurple, Colors.amberAccent],   // this line give a error
  tileMode: TileMode.mirror,
)

LinearGradient(
  colors: gradient,   // this line give a error
  stops: stops,    // this line give a error
  end: Alignment.bottomCenter,
  begin: Alignment.topCenter,
)

颤抖的医生-v:

[✓] Flutter (Channel stable, 1.22.1, on Mac OS X 10.15.3 19D76, locale en-GB)
    • Flutter version 1.22.1 at /Users/pkimac/Development/flutter
    • Framework revision f30b7f4db9 (2 days ago), 2020-10-08 10:06:30 -0700
    • Engine revision 75bef9f6c8
    • Dart version 2.10.1

注意:此错误产生的是编译时而不是运行时 有什么办法解决这个问题?

0 个答案:

没有答案