简体   繁体   English

如何在 Flutter 中创建渐变六边形

[英]How can I create fading hexagon in Flutter

Fading hexagon褪色六边形

Hello, I want to create and Fading hexagon like in image with a fading purple circle middle on it.您好,我想创建和褪色的六边形,就像图像中的那样,中间有一个褪色的紫色圆圈。 What should I do?我应该怎么办?

You can achieve it by drawing a radial gradient as shown in this article .您可以通过绘制径向渐变来实现它,如本文所示。 Then your colors will be purple and transparent (or purple with an opacity set to 0).然后你的 colors 将是紫色和透明的(或不透明度设置为 0 的紫色)。 Then you have two possibilities, either you use a big rectangle as a mask for your gradient, either you draw two triangles over your gradient, one at each corner to create that masking effect.然后你有两种可能性,要么使用一个大矩形作为渐变的遮罩,要么在渐变上绘制两个三角形,每个角一个以创建遮罩效果。

Hope it helped and have a nice day希望它有所帮助,祝你有美好的一天

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM