I just have started learning flutter for about 2 weeks, but most of the time i don’t like the standart design styles that flutter’s widgets provide to us, so…..
I needed to create a cart button filled with black color that includes an icon(image) and than rotate button on 45 angle, but icon have to stay as normal.*
Example Image of rotated IconButton
So i came up with this solution:
Column(
children: [
Transform.rotate(
angle: 45 * pi / 180,
child: IconButton(
onPressed: () {},
padding: EdgeInsets.all(25),
style: IconButton.styleFrom(
elevation: 0,
backgroundColor: Colors.black,
foregroundColor: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
),
),
icon: Transform.rotate(
angle: -45 * pi / 180,
child: Image.asset(
'assets/icons/shopping-cart.png',
color: Colors.white,
width: 22,
),
),
),
),
],
),
**The question is:
Changed//
New: Is there is a better way to do it?**
So basically if i dont add a -45 angle to the icon(image), they would turn together.
2
Answers
Another way to rotate button
You may try this:
It will give you result like this: