用多种填充颜色扑向半圈
我想在颤音中创建它:
我知道您可以创建一个半个圆圈,例如 this 。
但是我如何获得这些多种填充颜色?
我知道有lineargradient
可以完成此操作。 (类似这样的东西)
但是我需要起作用,但是我需要使用每个颜色截面作为一个分开的零件/小部件,因为我想在下一步中对它们进行动画。
我怎么能完成这个?
I would like to create this in Flutter:
I know you can create a half circle like this.
But how I can get these multiple fill colors?
I know there is way to get this done with LinearGradient
. (something like this)
But this might work, but I need to each color-section as a separated part/widget because I want to animate them in the next step.
How could I get this done?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用自定义画家来执行此操作,但是我知道将每个颜色棒的动画动画都是具有挑战性的。我已经能够创建类似您需要的东西
我使用夹板窗口小部件切出底部的底部和正方形的底部右部分 - >半圆。
每个颜色栏都是一个容器,由于您想为每个栏进行动画操作,因此您可以轻松地用AnimatedContainer替换容器,然后从那里继续进行。您可能还需要使动画的窗口小部件陈述。
}
}
You can do this using Custom Painter but then I understand it would be challenging to animate each color bar. I have been able to create something like you need
I used the ClipRRect widget to cut out the bottomLeft and bottomRight portions of a square -> SemiCircle.
Each Color bar is a Container and since you would like to animate each bar you can easily replace the Container with an AnimatedContainer and proceed from there. You might also need to make the widget stateful for animations.
}
}
请尝试以下代码:
您将获得如下:
Please try this below code:
You will get an output like below: