heyt0pe
heyt0pe

Reputation: 550

Flutter flip widget from side not middle

I'm trying to create a animation for widgets which would make them flip. I've found snippets online but they all flip the middle, I want to flip from the extreme left or rightenter image description here

Upvotes: 0

Views: 435

Answers (1)

heyt0pe
heyt0pe

Reputation: 550

It's a simple fix. If you already have a Transform widget that can do the image above, the alignment property of the widget is probably set to Alignment.center, change this to Alignment.centerLeft or Alignment.centerRight to flip from right to left or left to right respectively

...
child: Transform(
          transform: Matrix4.identity()...,
          alignment: Alignment.centerLeft,
          child: ...,
        ),
);

Upvotes: 1

Related Questions