I want to build a reusable card widget it will have an image and text with some custom design layout. I tried everything I could but wasn't able to achieve the desired result. Any help would be much appreciated. This is what I want to do
This is my code
class ReusabelCard extends StatelessWidget {
ReusabelCard(
{this.cardChild, @required this.assetImagePath, @required this.cardText});
final Widget cardChild;
final String assetImagePath;
final String cardText;
@override
Widget build(BuildContext context) {
return Container(
height: MediaQuery.of(context).size.height * 0.35,
width: MediaQuery.of(context).size.width * 0.5,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(MediaQuery.of(context).size.width * 0.5 * 0.28),
),
child: Stack(
children: [
LayoutBuilder(
builder: (context, contraint) {
return Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Icon(
Icons.trip_origin,
size: contraint.biggest.width,
color: Colors.grey[300],
),
Container(
height: MediaQuery.of(context).size.height*0.05,
width: MediaQuery.of(context).size.width,
color: Colors.green,
),
],
);
},
),
],
)
);
}
}
question from:https://stackoverflow.com/questions/65598454/how-to-clip-one-container-over-another-in-flutter