我的 parent 容器如何隐藏 child 容器的角
How can my parent Container hide the corners of the child Container
parent 容器有边框半径,我想将其应用到它的 children。相反,我得到这个
如您所见,child 容器的角在边框上方。如何隐藏 child 的角?
Container(
width: screenWidth / 3,
height: screenHeight * 0.8,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(55),
border: Border.all(
color: Colors.black26,
),
),
child: Column(
children: [
Container(
width: screenWidth / 3,
height: 139,
color: Colors.amberAccent,
)
],
),
),
你必须使用 ClipRRect 小部件。
Container(
width: screenWidth / 3,
height:screenHeight * 0.8,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(55),
border: Border.all(
color: Colors.black26,
),
),
child: ClipRRect(
borderRadius: BorderRadius.circular(55),
child: Column(
children: [
Container(
width: screenWidth / 3,
height: 139,
color: Colors.amberAccent,
)
],
),
),
)
parent 容器有边框半径,我想将其应用到它的 children。相反,我得到这个
如您所见,child 容器的角在边框上方。如何隐藏 child 的角?
Container(
width: screenWidth / 3,
height: screenHeight * 0.8,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(55),
border: Border.all(
color: Colors.black26,
),
),
child: Column(
children: [
Container(
width: screenWidth / 3,
height: 139,
color: Colors.amberAccent,
)
],
),
),
你必须使用 ClipRRect 小部件。
Container(
width: screenWidth / 3,
height:screenHeight * 0.8,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(55),
border: Border.all(
color: Colors.black26,
),
),
child: ClipRRect(
borderRadius: BorderRadius.circular(55),
child: Column(
children: [
Container(
width: screenWidth / 3,
height: 139,
color: Colors.amberAccent,
)
],
),
),
)