Abi*_*san 0 double types arguments flutter flutter-getx
我在我的 flutter 应用程序上使用Getxpackage。我想更新一个双精度值。但它告诉我一个错误。
这是我的 gextController
class CustomWebViewCTRL extends GetxController {
RxDouble progress = 0.0.obs;
onProgress(pro) {
progress = (pro / 100);
}
}
Run Code Online (Sandbox Code Playgroud)
然后我尝试在主屏幕上调用Obx(()=>)它GetBuilder。没有人为我工作。它说的是——
“参数类型‘RxDouble’不能分配给参数类型‘double’?”
这是一个示例(我想使用的地方):
GetBuilder<CustomWebViewCTRL>(builder: (controller) {
return LinearProgressIndicator(
value: controller.progress,
color: Colors.black,
backgroundColor: Colors.amber,
valueColor: const AlwaysStoppedAnimation<Color>(Colors.green),
);
}),
Run Code Online (Sandbox Code Playgroud)
我该如何解决这个问题?
当给 Rx Types 赋值时,使用 value property.try 用这个
progress.value = (pro / 100);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3158 次 |
| 最近记录: |