I need to draw a rounded border in just one side of a container. The problem is that this approach:
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.only(bottomLeft: Radius.circular(4.sp), bottomRight: Radius.circular(4.sp)),
border: Border(bottom: BorderSide(width: 2.sp, color: Color.fromARGB(255, 237, 237, 237))),
),
throws this error:
flutter: ══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════
flutter: The following assertion was thrown during paint():
flutter: A borderRadius can only be given for a uniform Border.
flutter: The following is not uniform:
flutter: BorderSide.color
flutter: BorderSide.width
flutter: BorderSide.style
Add a container with Box Shadow like this:
Container(
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
color: Colors.grey.shade100,
spreadRadius: 1,
blurRadius: 0,
offset: Offset(0, 0), // changes position of shadow
),
],
borderRadius: BorderRadius.only(
topLeft: Radius.circular(30.0),
topRight: Radius.circular(30.0),
),
),
)
Seems that it's not supported in Flutter yet .
You can do what you need through an stack (wash your hands after using this code, though):
Stack(children: [
Container(
width: double.infinity,
height: 8.sp,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(4.sp)),
border: Border.all(width: 2.sp, color: Color.fromARGB(255, 237, 237, 237)),
),
),
Container(
width: double.infinity,
height: 3.sp,
color: Colors.white, //or your bg color
),
])
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.