Flutter Card Properties

We can customize the card using the properties. Some of the essential properties are given below:

Attribute NameDescriptions
borderOnForegroundIt is used to paint the border in front of a child. By default, it is true. If it is false, it painted the border behind the child.
colorIt is used to color the card’s background.
elevationIt controls the shadow size below the card. The bigger elevation value makes the bigger shadow distance.
marginIt is used to customize the card’s outer space.
shapeIt is used to specify the shape of the card.
shadowColorIt is used to paint the shadow of a card.
clipBehaviorIt is used to clip the content of the card.

If we want to customize the card’s size, it is required to place it in a Container or SizedBox widget. Here, we can set the card’s height and width that can be shown in the below code:

Container(  
    width: 150,  
    height: 150,  
    child: Card(  
       ...  
    ),  
  )  

Leave a comment

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