flutter - 在 Web 服务器上运行时,sweepGradient 不起作用
问题描述
使用以下 cmd 行运行时
flutter run -d web-server --web-hostname=0.0.0.0
我的仪表看起来与 sweepGradient 的预期一样明显
但是当使用下面的 cmd 行运行时:
flutter run --web-renderer html -v -d web-server --web-hostname=0.0.0.0
下面是我的代码:
Widget build(BuildContext context) {
return SfRadialGauge(
axes: <RadialAxis>[
RadialAxis(
showLabels: false,
showTicks: false,
minimum: 0,
maximum: 100,
radiusFactor: 0.8,
axisLineStyle: const AxisLineStyle(
cornerStyle: CornerStyle.bothCurve,
thicknessUnit: GaugeSizeUnit.factor,
thickness: 0.1
),
annotations: <GaugeAnnotation>[
GaugeAnnotation(
angle: 180,
widget: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Container(
child: Text(
'50%',
style: TextStyle(
fontSize: 25,
fontWeight: FontWeight.bold),
),
),
],
)),
],
pointers: const <GaugePointer>[
RangePointer(
value: 50,
cornerStyle: CornerStyle.bothCurve,
enableAnimation: true,
animationDuration: 4500,
animationType: AnimationType.ease,
sizeUnit: GaugeSizeUnit.factor,
gradient: SweepGradient(
colors: <Color>[Color(0xFFFCE38A), Color(0xFFF38181)],
stops: <double>[0.25, 0.75]),
color: Color(0xFF00A8B5),
width: 0.15),
]),
],
);
}
当两者都在 Web 服务器上运行时,为什么我会得到两个不同的结果?
解决方案
尝试使用您的其他 Web 渲染器command
:
renderer canvaskit
代替
renderer html
推荐阅读
- android - 更改活动时保存数据
- c# - 在结果文件 C# 中打印出不需要的空格
- python - (Django/Python) 如何限制 onetoonefield 的选择?
- python - 如何在 Python 中对 3D 数组应用克里金法?
- ruby-on-rails - 如果其他用户在同一浏览器上登录,用户点击忘记密码链接最终会登录到应用程序
- python - 在 Python 2-7 中打印 XML 元素的所有属性
- javascript - 为什么我对两个选择器的比较永远不起作用?
- node.js - 通过 webpack 提供的 bundle.js 不适用于 webpack-dev-middleware + HtmlWebpackPlugin
- angular - 将数据从服务传递到父组件,然后从父组件传递到子组件
- android - Firebase 无法写入数据库且没有错误