How to Set Image Border Width in Flutter iOS Android Example

As we all know Image widget directly dose not support Border format so we would wrap the Image widget in Container widget and apply border on it. The BoxDecoration() method supports border width in double format. The default width value is 1.0 pixel. So if you would not pass the width in BoxDecoration() it will by default set the width in 1.0 pixel. So in this tutorial we would Set Image Border width in Flutter iOS Android App Example.

Contents in this project Set Image Border width in Flutter iOS Android Example:

1. Import material.dart package in your main.dart file.

2. Calling our main MyApp class using void main runApp() method.

3. Creating our main MyApp class extends with StatelessWidget.

4. Creating widget build method in MyApp class. Inside this method we would pass all our widgets.

5. Creating SafeArea widget in body section of Scaffold widget. This widget will automatically move below the view from status bar.

6. Creating Center widget in SafeArea to put all content at the center of screen.

7. In the center widget we would put Column widget which supports multiple children views.

8. Now finally we would make Container widget and put the Image widget on it. We would apply the border on Image using Container widget.

width : Supports double value and the default value is 1.0

9. Complete source code for main.dart file:

Screenshot:

How to Set Image Border width in Flutter iOS Android Example

Leave a Reply

Your email address will not be published. Required fields are marked *