扑来 - 指标progresscolor百分比

发布于 2025-01-31 23:53:23 字数 1117 浏览 1 评论 0原文

我使用 percen_indicator 软件包。我将圆形ppercenticator用姿势包装,每次触摸函数都会增加启动参数。

每次我点击以将数字值提高一个时,循环percenticticator颜色就会重新开始。例如;我的启动参数是8,一旦我触摸它,我的启动参数为9,但是圆形ppercentIndicator从0到9开始。

int start = 0;

GestureDetector(
          child: CircularPercentIndicator(
            radius: 100.0,
            lineWidth: 13.0,
            animation: true,
            percent: start.toDouble() / 100,
            center: Text(
              start.toString(),
              style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 20.0),
            ),
            footer: const Text(
              "Sales this week",
              style: TextStyle(fontWeight: FontWeight.bold, fontSize: 17.0),
            ),
            circularStrokeCap: CircularStrokeCap.round,
            progressColor: Colors.purple,
          ),
          onTap: () {
            start = start + 1;
            setState(() {});
            print(start.toString());
          },
        ),

i use percent_indicator package. I wrapped CircularPercentIndicator with Gesturedetetor, i increase start parameter every touch onTap function.

Every time I tap to increase the numeric value by one, the CircularPercentIndicator color starts over. For example; My start parameter is 8 and once I touched it, my start parameter is 9, but the CircularPercentIndicator starts from 0 to 9.

int start = 0;

GestureDetector(
          child: CircularPercentIndicator(
            radius: 100.0,
            lineWidth: 13.0,
            animation: true,
            percent: start.toDouble() / 100,
            center: Text(
              start.toString(),
              style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 20.0),
            ),
            footer: const Text(
              "Sales this week",
              style: TextStyle(fontWeight: FontWeight.bold, fontSize: 17.0),
            ),
            circularStrokeCap: CircularStrokeCap.round,
            progressColor: Colors.purple,
          ),
          onTap: () {
            start = start + 1;
            setState(() {});
            print(start.toString());
          },
        ),

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

逐鹿 2025-02-07 23:53:24

如果您检查插件源代码,那就是插件的开发方式,它会更新进度并运行_animation.forward(),这将使动画从0 -CurrentProgress开始。

If you check the plugin source code, that is how the plugin is developed, it updates the progress, and runs the _animation.forward(), which will make the animation start from 0 - currentProgress.

缺⑴份安定 2025-02-07 23:53:24

我找到了解决方案。下面有一个属性。

animateFromLastPercent: true

I found the solution. There is a property like below.

animateFromLastPercent: true
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文