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.*
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.
romanart is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
2