I want to make a UI which has a outer container which has border. Inside the container I have a column which contains a image and a container text inside. I want the inner container which has text to on top of border of outer container so that border is not visible where inner container is present here is my code.
I want this output
I get this result I dont want border to be shown on bottom
Container(
decoration: BoxDecoration(
border: Border.all(
color: const Color(0xFFEDEDED),
),
borderRadius: BorderRadius.circular(8),
color: Colors.white,
boxShadow: [
BoxShadow(
offset: const Offset(0, 4),
blurRadius: 8,
color: const Color(0xff000000).withOpacity(0.25),
)
],
),
child: Column(
children: [
// * IMAGE
Padding(
padding: const EdgeInsets.symmetric(vertical: 16),
child: Image.asset(
image,
width: 96,
height: 96,
),
),
// * ---------------
// * INNER CONTAINER
// * ---------------
Container(
height: 40,
clipBehavior: Clip.antiAlias,
padding: const EdgeInsets.symmetric(horizontal: 4),
width: double.infinity,
decoration: BoxDecoration(
color: backgroundColor,
border: Border.all(color: backgroundColor),
borderRadius: const BorderRadius.only(
bottomLeft: Radius.circular(8),
bottomRight: Radius.circular(8),
),
),
child: Center(
child: Text(
title,
textAlign: TextAlign.center,
style: const TextStyle(
fontSize: 13,
fontWeight: FontWeight.w500,
color: Colors.white),
),
),
)
],
),
);
3
Answers
Here, you can refer to the below code for your design:
And it will look like this:
Don’t forget to replace the Icon widget with the your existing image widget and set size as per your need