This code is that I have tried.
Container(
height: 250,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
),
child: Stack(
children: [
Positioned.fill(
child: Image.asset(
'assets/images/background.png',
fit: BoxFit.cover,
),
),
Positioned.fill(
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: Colors.black.withOpacity(0.35),
),
),
),
Center(
child: ClipRRect(
borderRadius: BorderRadius.circular(12),
child: Container(
padding: const EdgeInsets.all(20),
color: Colors.transparent,
child: const Text(
'Scrollable Component at the Top',
style: TextStyle(
fontSize: 20,
color: Colors.white,
),
),
),
),
),
],
),
),
I tried to fix it by using ClipRRect
widget but it didn’t work for me.
2
Answers
Wrapping the
Container
withClipRRect
should work. Make sure your image fills the full height so theClipRRect
doesn’t clip the border in the extra empty space.Result:
i’m trying to figure out what exactly your problem is. your possible needs will found in the following code
here are some of done work:
content.
ClipRRect
rounded and it’s provedby shpe of its borders
, try to remove border property of the
BoxDeconration
of that container.here’s the code:
here’s the result:
you can remove the white borders of the container just by removing border property from
BoxDecoration.
hope it helps you.