How to use BoxDecoration to a Container widget to draw an image

0 votes

Hi Guys,

I am new in Flutter design. I want to use one image in a container widget using BoxDecoration. How can I do that?

Aug 9, 2020 in Others by akhtar
• 38,260 points
5,798 views

1 answer to this question.

0 votes

Hi@akhtar,

The BoxDecoration class provides a variety of ways to draw a box. The box has a border, a body, and may cast a boxShadow. The shape of the box can be a circle or a rectangle. If it is a rectangle, then the borderRadius property controls the roundness of the corners. The following applies a BoxDecoration to a Container widget to draw an image of an owl with a thick black border and rounded corners.

Container( 
decoration: BoxDecoration( 
color: const Color(0xff7c94b6), 
image: const DecorationImage( 
image: NetworkImage('https://flutter.github.io/assets-for-api-docs/assets/widgets/owl-2.jpg'), 
fit: BoxFit.cover, ), 
border: Border.all( color: Colors.black, width: 8, ), 
borderRadius: BorderRadius.circular(12), ), )
answered Aug 9, 2020 by MD
• 95,460 points

Related Questions In Others

0 votes
0 answers

how to list the contents of a asset into an event

May 29, 2019 in Others by anonymous
660 views
0 votes
0 answers

How to open a new tab or a new window while writing an exam in AI - Onlime Remote Proctored

How to open a new tab or ...READ MORE

Jul 20, 2020 in Others by vimalkamal
• 120 points
3,646 views
0 votes
2 answers

How to set margin for a Container in Flutter?

Container( margin: const EdgeInsets.fromLTRB(20, 10, 20, ...READ MORE

answered Apr 17, 2023 in Others by anonymous
9,260 views
0 votes
1 answer

How to use Card Widget in Flutter App?

Hi@akhtar, A card is a sheet of material used to ...READ MORE

answered Aug 26, 2020 in Others by MD
• 95,460 points
1,141 views
0 votes
1 answer

What is the future of flutter?

Hi@MD, Flutter is a rather new cross-platform framework ...READ MORE

answered Jul 17, 2020 in Others by akhtar
• 38,260 points
1,147 views
0 votes
1 answer

What is Flutter?

Hi@akhtar, Flutter is an app SDK for building ...READ MORE

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

How to install Flutter in Windows system?

Hi@akhtar, You can follow the below-given steps to ...READ MORE

answered Jul 17, 2020 in Others by MD
• 95,460 points
1,781 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,187 views
0 votes
1 answer

How to add a border to a widget in Flutter?

Hi@akhtar, You need to add the TextField as a child to a Container that has ...READ MORE

answered Jul 24, 2020 in Others by MD
• 95,460 points
3,816 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