Issue
I put a IconButton to SliverAppBar actions , but the output compress to oval shape
actions: [
IconButton(
splashRadius: 23,
icon: Container(
decoration: BoxDecoration(
color: Color(0xFF05122B),
borderRadius: BorderRadius.circular(100)
),
padding: EdgeInsets.all(10),
child: Center(child: Icon(OIcons.share, color: Colors.white, size: 20))
),
onPressed: (){
},
),
],
if using shape with padding , icon not align center
IconButton(
splashRadius: 23,
icon: Container(
decoration: BoxDecoration(
color: Color(0xFF05122B),
shape: BoxShape.circle
),
padding: EdgeInsets.all(10),
child: Center(child: Icon(OIcons.share, color: Colors.white, size: 20))
),
onPressed: (){
},
),
if using shape with width and height , no matter how much width and height is set, the button size still small.
IconButton(
splashRadius: 23,
icon: Container(
decoration: BoxDecoration(
color: Color(0xFF05122B),
shape: BoxShape.circle
),
height: 50,
width: 50,
child: Center(child: Icon(OIcons.share, color: Colors.white, size: 20))
),
onPressed: (){
},
),
Solution
You can use CircleAvatar instead of Container
CircleAvatar(
backgroundColor: Color(0xFF05122B),
child: IconButton(
padding: EdgeInsets.all(0),
splashRadius: 23,
icon: Icon(Icons.share, color: Colors.white, size: 20),
onPressed: () {},
),
),
Answered By - zafercaliskan



0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.