Flutter Card 组件,卡片组件具有圆角和阴影,看起来有立体感。
参数详解
| 属性 | 说明 |
| color | 颜色 |
| elevation | 阴影大小 |
| shape |
Card 的阴影效果 默认形状为圆角半径为4.0的圆角矩形边框。 |
| borderOnForeground | 默认true |
| margin | 外边距 |
| clipBehavior | 剪辑窗口小部件内容的不同方法。如果内容没有溢出小部件边界,则不要为剪辑支付任何性能成本。 |
| child | 子元素 |
| semanticContainer | 默认true |
代码示例
class MyBodyA extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Card(
// color: Colors.blue[50],
margin:EdgeInsets.all(20),
elevation: 10,
child: Container(width: 150,height: 150,),
);
}
}
效果图

本文详细介绍Flutter中的Card组件,包括其参数如颜色、阴影大小、边框形状等,并提供代码示例,展示如何创建具有圆角和阴影效果的卡片。
1265

被折叠的 条评论
为什么被折叠?



