我正在寻找创建带有左上和右上半径且没有底部边框的圆角容器的方法。以下是我尝试过的方法:
Container(
decoration: BoxDecoration(
border: Border(
left: BorderSide(
color: AppColors.lightPurple2,
),
right: BorderSide(
color: AppColors.lightPurple2,
),
top: BorderSide(
color: AppColors.lightPurple2,
),
),
// border: Border.all(
// color: AppColors.lightPurple2,
// ),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(Rad.sm),
topRight: Radius.circular(Rad.sm),
),
),
但是这段代码不能正常运行。
======== Exception caught by rendering library =====================================================
The following assertion was thrown during paint():
A borderRadius can only be given for a uniform Border.
The following is not uniform:
BorderSide.color
BorderSide.width
BorderSide.style
然而,如果我使用Border.all(),它可以很好地工作,但我需要以某种方式删除底部边框。如果我删除borderRadius,它会绘制3个边框,但没有圆角。
所以有没有办法同时使用这两个选项?
我最终想要的是: