Skip to content

Instantly share code, notes, and snippets.

@mewben
Created October 30, 2019 07:03
Show Gist options
  • Save mewben/f84ba2e3037f0af202d3aa2df96aa6dc to your computer and use it in GitHub Desktop.
Save mewben/f84ba2e3037f0af202d3aa2df96aa6dc to your computer and use it in GitHub Desktop.
Flutter: Rotate Icon by 90 degrees
import 'package:flutter/material.dart';
import 'dart:math';
class RotatedIcon extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Transform.rotate(
angle: 90 * pi/180,
child: Icon(Icons.flight),
);
}
}
@diegoalex
Copy link

You can also use the RotationTransition widget.No need to import math and you only divide the angle by 360.

RotationTransition(
        turns: AlwaysStoppedAnimation(90 / 360),
        child: Icon(Icons.arrow_drop_down),
      ),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment