I want to create circular borders around the icons as shown in the image.
Container(
margin: EdgeInsets.all(20),
padding: EdgeInsets.all(10),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(100),
color: Colors.white,
border: Border.all(
width: 2
)
),
child: Icon(Icons.arrow_downward,color: Colors.white,),
)
I don't need cuts in the circular borders as they are shown in the image but the complete circular border, I have also tried this code =>This Answer
To add border to image in Flutter, first, wrap the Image widget inside the Container widget. Inside the Container, add the decoration property and assign the BoxDecoration widget. Using the border property of BoxDecoration, you can provide the Border. all() widget to create border around the image.
Steps to add border to container in Flutter:Step 1: Go to the Container in which you want to add a border. Step 2: Add the decoration parameter and assign the BoxDecoration class. Inside the BoxDecoration add the parameter border and set it to Border. all().
Steps to change icon button color in FlutterLocate the file where you have placed the IconButton widget. Inside the IconButton widget, add the color parameter and assign the color of your choice. Run the App.
Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
border: Border.all(color: Colors.white)
),
child: Icon(Icons.check, color: Colors.white,),
)
or you can use Material if you're going to need some fancy effects:
Material(
color: Colors.transparent,
shape: CircleBorder(
side: BorderSide(color: Colors.white)
),
child: Icon(Icons.check, color: Colors.white,),
)
I am doing some mistakes in my above code. but I have figured out and here is the new code.
Container(
margin: EdgeInsets.all(20),
padding: EdgeInsets.all(10),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(100),
border: Border.all(width: 2, color: Colors.white)),
child: Icon(
Icons.cancel,
color: Colors.white,
),
)),
Also if you want to make complete Widget clickable then you can use it like this.
GestureDetector(
onTap: () {
//Navigator.of(context).pop();
},
child: new Align(
alignment: Alignment.bottomRight,
child: Container(
margin: EdgeInsets.all(20),
padding: EdgeInsets.all(10),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(100),
border: Border.all(width: 2, color: Colors.white)),
child: Icon(
Icons.cancel,
color: Colors.white,
),
)),
),
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With