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,180 points
958 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"),
)
answered Jul 24, 2020 by MD
• 95,240 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,180 points
1,533 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,240 points
1,923 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,240 points
160 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,240 points
181 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,240 points
991 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,240 points
3,597 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,240 points
2,093 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,240 points
300 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,240 points
4,875 views