kevlatus/flutter_fortune_wheel

Rotate texts after certain degree

DanielMartini opened this issue · 2 comments

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!

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]),
        ),
      )
  ],
);

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