How to add border to a widget in Flutter

You can add a border to any widget in Flutter.All you have to do is to make Container widget as the parent of the target widget.The Container contains a decoration parameter which can be manipulated as per requirement.Suppose we have a Text widget like:-

Text("Hello Everyone!!! Welcome to TechStroke!");

This will give something like this:-

But if we add a Container like this:-

         decoration: BoxDecoration(border: Border.all()),
         child: Text(
           "Hello Everyone!!! Welcome to TechStroke!",
             style: TextStyle(fontSize: 22.0),

Will give output like this:-

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.