Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to rotate material icon in flutter without animation?

Tags:

enter image description here

I want the icon details to point upward like as shown in the image. but the list of material icon has icon details points to downward, so how can I rotate the material icon in my flutter project, without downloading the icon image.

enter image description here

 Column(   children: <Widget>[     Container(       height: 48,       decoration: BoxDecoration(           color: Color(0xFFFBBC05),           borderRadius: BorderRadius.circular(48),           boxShadow: [             BoxShadow(                 blurRadius: 16,                 offset: Offset(0, 8),                 color: Color(0XFFFBBC05),                 spreadRadius: -10)           ]),       child: IconButton(         icon: Icon(           Icons.details,           color: Colors.white,         ),         onPressed: null,       ),     ),     SizedBox(       height: 8,     ),     Text(       "Historical",       style: TextStyle(fontFamily: 'AirbnbCerealMedium', fontSize: 12),     ),   ], ) 
like image 957
Tushar Rai Avatar asked Jun 27 '19 07:06

Tushar Rai


People also ask

How do you rotate a material icon?

First make sure you have added Material Icon library. If this library is added just add the HTML css class rotate_right to any element to add the icon. Material Design Rotate Right Icon can be resized as per your need. You can manage size of icon(rotate_right) by using font-size css style.


1 Answers

You can wrap your IconButton in a Transform widget using the rotate constructor:

import 'dart:math' as math;  Transform.rotate(   angle: 180 * math.pi / 180,   child: IconButton(     icon: Icon(       Icons.details,       color: Colors.white,     ),     onPressed: null,   ), ), 
like image 144
Jordan Davies Avatar answered Sep 29 '22 01:09

Jordan Davies