Flutter开发之——Card

一 概述

  • Card是Material风格的卡片控件,Card有较小的圆角和阴影。
  • Card通常用于展示一组信息

二 Card

2.1 构造方法

 const Card({
    Key? key,
    this.color,
    this.shadowColor,
    this.elevation,
    this.shape,
    this.borderOnForeground = true,
    this.margin,
    this.clipBehavior,
    this.child,
    this.semanticContainer = true,
  }) 

2.2 属性说明

属性说明取值
color背景颜色Color
elevation阴影值double
shadowColor阴影颜色Color
child子控件Widget
shape形状ShapeBorder

三 示例

3.1 代码

Column(
       children: [
       Card(
              shadowColor: Colors.yellowAccent,
              shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(15)),
              //color: Colors.orange,
              elevation: 30,
              child: Column(
                mainAxisSize: MainAxisSize.min,
                children: <Widget>[
                  const ListTile(
                    leading: Icon(Icons.album),
                    title: Text('Title-1'),
                    subtitle: Text('Subtitle-1'),
                  ),
                  Row(children: [
                    FlatButton(child: const Text('OK',style:TextStyle(color: Colors.blue) ,), onPressed: () {},),
                    FlatButton(child: const Text('Cancel',style:TextStyle(color: Colors.blue)), onPressed: () {},),
                  ],)
                ],
              ),
            ),
            Divider(thickness: 10,indent: 20,endIndent: 20,color: Colors.deepOrange,),
            Card(
              shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(15)),
              //color: Colors.orange,
              elevation: 10,
              child: Column(
                mainAxisSize: MainAxisSize.min,
                children: <Widget>[
                  const ListTile(
                    leading: Icon(Icons.album),
                    title: Text('Title-2'),
                    subtitle: Text('Subtitle-2'),
                  ),
                  Wrap(children: [
                    FlatButton(child: const Text('OK',style:TextStyle(color: Colors.blue) ,), onPressed: () {},),
                    FlatButton(child: const Text('Cancel',style:TextStyle(color: Colors.blue)), onPressed: () {},),
                  ],)
                ],
              ),
            ),
            Divider(thickness: 10,indent: 20,endIndent: 20,color: Colors.green,),
            Card(
              shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(15)),
              //color: Colors.orange,
              elevation: 10,
              child: Column(
                mainAxisSize: MainAxisSize.min,
                children: <Widget>[
                  const ListTile(
                    leading: Icon(Icons.album),
                    title: Text('Title-3'),
                    subtitle: Text('Subtitle-3'),
                  ),
                  ButtonBar(
                    children: <Widget>[
                      FlatButton(child: const Text('OK'), onPressed: () {},),
                      FlatButton(child: const Text('Cancel'), onPressed: () {},),
                    ],
                  )
                ],
              ),
            ),
          ],
        )

3.2 效果图

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值