1. Add rounded corners
Container( width: 100, height: 100, decoration: BoxDecoration( color: Colors.teal, borderRadius: BorderRadius. Circular (20), // Can also be set separately, as follows BorderRadius: BorderRadius. Only (topLeft: Radius. Circular (15), topRight: Radius.circular(15), bottomLeft: Radius.circular(15), bottomRight: Radius.circular(15), ), ), )Copy the code
2. Add shadows
Container( width: 100, height: 100, decoration: BoxDecoration( color: Colors.teal, borderRadius: BorderRadius. Circular (20), boxShadow: [boxShadow (color: Colors. Red, // Shadow color blurRadius: SpreadRadius: 2, // Shadow blur size),],,),)Copy the code
Add a gradient
Container( width: 500, height: 500, alignment: Alignment.center, decoration: BoxDecoration( color: Colors. White, gradient: LinearGradient(Colors: [color.red, // Color from red->amber color.amber,], begin: LinearGradient(Colors: [color.red, // color from red->amber color.amber,]) Alignment. TopLeft, // start position begin: Alignment(10,20), // can also be a specific coordinate value end: Alignment. BottomRight, // end position is the same as above),), child: Text('container'), ),Copy the code
4. Shape
Container( width: 500, height: 500, alignment: Alignment.center, decoration: BoxDecoration( color: Colors.white, shape: Rectangle (rectangle); rectangle(rectangle); rectangle(rectangle); rectangle(rectangle); rectangle(rectangle);Copy the code
5. Container limitation
Container( width: 500, height: 500, alignment: Alignment.center, constraints: BoxConstraints( maxHeight: 200, // maxWidth: 260, // maxWidth: 100, // minWidth: 100, // minWidth: 100, // minWidth: 100, // minWidth: 100,Copy the code