I wanted to create a box with a rectangular body. And my code is given below. Here BoxShape is underlined and the error message says: Enums can't be instantiated. Try using one of the defined constants. How will I solve this? I wanted to create a container box with rounded edges in flutter.
home: Scaffold(
appBar: AppBar(
backgroundColor:Theme.of(context).primaryColor,
leading:Icon(Icons.arrow_back),
),
body: Scaffold(backgroundColor:Color(0xBBCCE3F0) ,
body: Center(
child: Container(
decoration:new BoxDecoration(
shape:BoxShape(BorderRadius.circular(10.0))
),
color:Colors.white,
child:SizedBox(height:500.0,width:300,
)
Use this as decoration.This will give radius to container.
borderRadius: BorderRadius.circular(10),
You can achieve it like this:
> Container(
> decoration:new BoxDecoration(
> border: Border.all( borderRadius: BorderRadius.circular(10), ),
> ),
> color:Colors.white,
> child:SizedBox(height:500.0,width:300,
> )
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.