2.
// OverFlowBox组件,可以做一些卡片重叠的效果
class OverFlowBoxDemo extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
color: Colors.green,
height: 100,
width: 200,
padding: EdgeInsets.only(left: 16, right: 16, top:56),
// 溢出容器
child: OverflowBox(
// 对齐方式
alignment: Alignment.topCenter,
maxHeight: 100,
maxWidth: 180,
child: Container(
color: Colors.blue,
height: 100,
width: 180,
),
),
);
}
}