受限制的Box控件
const BoxConstraints({
this.minWidth = 0.0,
this.maxWidth = double.infinity,
this.minHeight = 0.0,
this.maxHeight = double.infinity,
});
class ConstrainedBoxWidget extends StatelessWidget { @override Widget build(BuildContext context) { return _myWidget; } get _myWidget { return ConstrainedBox( constraints: BoxConstraints( minHeight: 30, minWidth: 30, maxHeight: 150, maxWidth: 150 ), child: Container( 200, height: 150, decoration: BoxDecoration( borderRadius: BorderRadius.circular(20), gradient: LinearGradient( colors: [Colors.blue, Colors.purple], ) ) ) ); } }