How to add a border to a widget in Flutter

0 votes

Hi Guys,

I'm using Flutter and I want to like to add a border to a widget. I tried TextStyle and Text, but I didn't see how to add a border. Can anyone tell me how can I do that?

Jul 24, 2020 in Others by akhtar
• 38,260 points
3,806 views

1 answer to this question.

0 votes

Hi@akhtar,

You need to add the TextField as a child to a Container that has a BoxDecoration with border property. You can see the below block of code.

new Container(
  margin: const EdgeInsets.all(15.0),
  padding: const EdgeInsets.all(3.0),
  decoration: BoxDecoration(
    border: Border.all(color: Colors.blueAccent)
  ),
  child: Text("My Awesome Border"),
)

To know more, join our Flutter Certification today.

answered Jul 24, 2020 by MD
• 95,460 points

Related Questions In Others

0 votes
1 answer

How to add a border in a Container in Flutter?

Hi@MD, By default, you can't see any border ...READ MORE

answered Sep 10, 2020 in Others by akhtar
• 38,260 points
3,198 views
0 votes
1 answer

How to add a Header Row to a ListView in Flutter?

Hi@akhtar, You can use ListView.builder method in your ...READ MORE

answered Sep 15, 2020 in Others by MD
• 95,460 points
4,277 views
0 votes
1 answer

How to add a Webview in Flutter?

Hi@akhtar, You need to use a plugin to ...READ MORE

answered Sep 15, 2020 in Others by MD
• 95,460 points
833 views
0 votes
1 answer

How to create a Project in Flutter?

Hi@akhtar, Flutter has an inbuilt command to create ...READ MORE

answered Jul 20, 2020 in Others by MD
• 95,460 points
883 views
0 votes
1 answer

What is pubspec.yaml file in Flutter?

Hi@akhtar, It is the project's configuration file that ...READ MORE

answered Jul 20, 2020 in Others by MD
• 95,460 points
3,378 views
0 votes
1 answer

Error: No pubspec.yaml file found.

Hi@akhtar, You need to run this command from ...READ MORE

answered Jul 20, 2020 in Others by MD
• 95,460 points
9,001 views
0 votes
1 answer

How to launch an emulators from Flutter?

Hi@akhtar, Before launching emulators you should check if ...READ MORE

answered Jul 20, 2020 in Others by MD
• 95,460 points
6,250 views
0 votes
1 answer

How to create a container widget in Flutter?

Hi@akhtar, Container means a parent widget that contains ...READ MORE

answered Jul 28, 2020 in Others by MD
• 95,460 points
2,174 views
0 votes
1 answer

How to add a send button inside TextField in Flutter?

Hi@akhtar, You can use decoration inside your TextField. ...READ MORE

answered Sep 10, 2020 in Others by MD
• 95,460 points
25,059 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP