Hello Developes in this tutorial we will discuss about how you can decorate container in flutter .
Table of Contents
1:What is Container
Container is assume as empty box where you can put your items in the form of widgets like Text(),Column(),Row() and other widgets . Using container we can add padding , margin and much more with box-decoration.
2:Box decoration properties
Box decoration comes with several properties like color,image,border,borderRadius,box shadow,gradient,boxshape .

Container widget can be used by any child or within children of Column() and Row(),
code for container : Copy
child: Container(
height: 200.0,
width: 200.0,
decoration: BoxDecoration(
color: Colors.blueAccent,
border: Border.all(
color: Colors.black,
width: 2.0,
),
borderRadius: BorderRadius.circular(10.0),
gradient: const LinearGradient(
colors: [Colors.indigo, Colors.blueAccent]),
boxShadow: [
const BoxShadow(
color: Colors.grey,
blurRadius: 4.0,
offset: Offset(10.0, 10.0))
]),
),

3: Border radius with only
To applying border-radius on the side specifies we can implement by using BorderRadius.only()
code for border radius: Copy
decoration: BoxDecoration(
color: Colors.blueAccent,
border: Border.all(
color: Colors.black,
width: 2.0,
),
borderRadius: const BorderRadius.only(
topRight: Radius.circular(50),
bottomLeft: Radius.circular(50)),
gradient: const LinearGradient(
colors: [Colors.indigo, Colors.blueAccent]),
boxShadow: const [
BoxShadow(
color: Colors.grey,
blurRadius: 4.0,
offset: Offset(10.0, 10.0))
]),

0 Comments (Please let us know your query)