kevlatus / flutter_fortune_wheel

Visualize random selections with Flutter widgets like the wheel of fortune.
https://kevlatus.github.io/flutter_fortune_wheel
MIT License
102 stars 81 forks source link

Rotate texts after certain degree #80

Closed DanielMartini closed 2 years ago

DanielMartini commented 2 years ago

Hello!

Im on the situation that I need all the texts to be easy readable, this is hard after you have few items because they are upside down

is it possible to rotate the texts if they have certain degree? just like the image:

img-wheel-256

thanks!

kevlatus commented 2 years ago

Hi @DanielMartini, you can easily achieve this with code similar to the one below:

final items = [...];
return FortuneWheel(
  ...
  items: [
    for (var i = 0; i < items.length; i++)
      FortuneItem(
        child: Transform.rotate(
          angle: i > (items.length / 2) ? math.pi : 0,
          child: Text(items[i]),
        ),
      )
  ],
);
DanielMartini commented 2 years ago

That was simple, didn't notice, thanks @kevlatus!