“LinearStrokeCap”已弃用,不应使用。该属性不再使用,请使用 barRadius 代替

Dc7*_*Dc7 7 dart flutter flutter-dependencies flutter-layout

我正在创建线性百分比指标。我想在它周围实现圆形边框。

预期结果对比 实际结果

在此输入图像描述

我的代码

LinearPercentIndicator(
            linearStrokeCap: LinearStrokeCap.roundAll,
            progressColor: Colors.blue[400],
            backgroundColor: Colors.grey[300],
 ),
Run Code Online (Sandbox Code Playgroud)

错误

在此输入图像描述

任何解决方案

有什么解决方案可以使用 barRadius 作为 LinearStrokeCap 吗?

nag*_*nag 12

使用barRadius而不是linearStrokeCap. 由于LinearStrokeCap已弃用,他们建议使用barRadius.

更新的代码:

LinearPercentIndicator(
  lineHeight: 30,
  percent: 0.7,
  barRadius: const Radius.circular(16),
  progressColor: Colors.blue[400],
  backgroundColor: Colors.grey[300],
),
Run Code Online (Sandbox Code Playgroud)

输出:

在此输入图像描述