Add Border To Main Root Scaffold Container Widget in Flutter

Hello friends, Recently when I was installing a android application then I saw this app has a complete border around screen. So i thought let’s make this in flutter. Now the Scaffold widget does not support border property. If we want to apply border around Root View screen in flutter then we have to use Container widget. Now as we all know it does support width and height but when we do not pass width and height then it will automatically occupy all the space given by its parent. So we call the Container widget as our Root widget and put border on it. So in this tutorial we would learn about Add Border To Main Root Scaffold Container Widget in Flutter.

Contents in this project Add Border To Main Root Scaffold Container Widget in Flutter :-

1. Open your project’s main.dart file and import material.dart package.

2. Creating void main runApp() method and here we would call our main MyApp class.

3. Creating our main MyApp extends StatelessWidget class.

4. Creating Widget Build area -> Material App -> Scaffold widget -> SafeArea widget -> Container widget without width and height. So it will occupy all the Root space. You can put any widget as its child.

5. Complete source code for main.dart file :-

Screenshot :-

Add Border To Main Root Scaffold Container Widget in Flutter

Leave a Reply

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