Flutter RoundedRectangleBorder不适用于容器小部件
我需要使容器边缘成为圆形,以及在尝试RoundedRectangleBorder时如何使其显示错误Flutter RoundedRectangleBorder不适用于容器小部件,flutter,flutter-layout,Flutter,Flutter Layout,我需要使容器边缘成为圆形,以及在尝试RoundedRectangleBorder时如何使其显示错误 Container( width: 100,height: 100, margin: EdgeInsets.all(10.0), decoration: BoxDecoration( color: Colors.orange, shape: RoundedRectangleBorder( border
Container(
width: 100,height: 100,
margin: EdgeInsets.all(10.0),
decoration: BoxDecoration(
color: Colors.orange,
shape: RoundedRectangleBorder(
borderRadius: new BorderRadius.circular(18.0),
)
),
),
试试这个:
Container(
width: 100,height: 100,
margin: EdgeInsets.all(10.0),
decoration: BoxDecoration(
color: Colors.orange,
borderRadius: BorderRadius.circular(10.0)
),
),
这个错误表明,
参数类型RoundedRectangleBorder
不能分配给参数类型BoxShape
因此,如果要使用RoundedRectangleBorder
则必须在shape
参数中使用它
Container(
width: 100,height: 100,
margin: EdgeInsets.all(10.0),
decoration: ShapeDecoration(
color: Colors.orange,
shape: RoundedRectangleBorder( // <--- use this
borderRadius: BorderRadius.all(
Radius.circular(10),
),
),
),
),
容器(
宽度:100,高度:100,
保证金:所有边缘套(10.0),
装饰:造型装饰(
颜色:颜色。橙色,
形状:圆形矩形边框(//