How to add gradient color in card?
2,019
Try below code hope it help to you in below answer change Color your need.
Card(
child: Container(
height: 50,
width: 150,
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
Colors.yellow,
Colors.orangeAccent,
Colors.yellow.shade300,
],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
),
child: Container(), //declare your widget here
),
),
If you are gradient background to card or gradient border to card try below code
Container(
height: 50,
width: 150,
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
Colors.yellow,
Colors.orangeAccent,
Colors.yellow.shade300,
],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
),
child:Card(
color:Colors.white,
child: Container(), //declare your widget here
),
),
Author by
Chloé
Updated on December 01, 2022Comments
-
Chloé over 1 year
How to add gradient color in the background of a card ? Should I reproduce this card with a container and a box decoration or is there another simple way ?
-
Filipe Piletti Plucenio over 2 yearsLet me know if this helped you.
-
Chloé over 2 yearsThx but it does not fit the border of the card :(
-
Chloé over 2 yearsThx but it does not fit the border of the card :(
-
Chloé over 2 yearsThx, this is the best alternative I had, but you must also add circle border and an InkWell widget to do it like a card. I will do this if there is no other solution..
-
Ravindra S. Patil over 2 yearsRefer my updated answer, one thing forgot black color of updated image try updated code hope it's helpful to you
-
Chloé over 2 yearsThank you but it still does not fit the border radius of the card.
-
Ravindra S. Patil over 2 yearscan you tell me the what do you want in image or picture?
-
Chloé over 2 yearsI do not need an image or a picture, but a gradient color.
-
Ravindra S. Patil over 2 yearsAre you Try my answer?