在我想使用的项目中SweepGradient,当我尝试使用此定义时,出现错误:
Context: Found this candidate, but the arguments don't match.
const SweepGradient({
^^^^^^^^^^^^^
Run Code Online (Sandbox Code Playgroud)
我的代码实现:
static final BoxDecoration _gradientBorderDecoration = BoxDecoration(
shape: BoxShape.circle,
// https://brandpalettes.com/instagram-color-codes/
gradient: SweepGradient(
colors: [
Color(0xFF833AB4), // Purple
Color(0xFFF77737), // Orange
Color(0xFFE1306C), // Red-pink
Color(0xFFC13584), // Red-purple
],
),
);
Run Code Online (Sandbox Code Playgroud)
SweepGradient 构造类:
const SweepGradient({
this.center = Alignment.center,
this.startAngle = 0.0,
this.endAngle = math.pi * 2,
required List<Color> colors,
List<double>? stops,
this.tileMode = TileMode.clamp,
GradientTransform? transform,
}) : assert(center != null),
assert(startAngle != null),
assert(endAngle != null),
assert(tileMode != null),
super(colors: colors, stops: stops, transform: transform);
Run Code Online (Sandbox Code Playgroud)
flutter 版本:
Flutter 1.22.0-10.0.pre.153 • channel master • https://github.com/flutter/flutter.git
Framework • revision 2e643651a9 (15 hours ago) • 2020-09-11 23:07:03 -0400
Engine • revision 16b900b63e
Tools • Dart 2.10.0 (build 2.10.0-117.0.dev)
Run Code Online (Sandbox Code Playgroud)
Chr*_*n X 48
在我升级到最新的稳定 Flutter 版本 1.12 后,这也发生在我身上。我修复它执行以下操作:
之后,一切又像魅力一样。
| 归档时间: |
|
| 查看次数: |
10779 次 |
| 最近记录: |