Card 摘要:

  • 实现了一个 Material Design card
  • 接受单个孩子,但该孩子可以是Row,Column或其他包含子级列表的widget
  • 显示圆角和阴影
  • Card内容不能滚动
  • Material Components 库的一个widget
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    class _home extends StatefulWidget {
    @override
    State<StatefulWidget> createState() {
    return _homeState();
    }
    }
    class _homeState extends State<_home> {
    @override
    Widget build(BuildContext context) {
    // TODO: implement build
    return new Scaffold(
    appBar: new AppBar(
    title: Text("title"),
    centerTitle: true,
    ),
    body: new Card(
    elevation: 4.0,//阴影
    color: Colors.grey,//背景色
    child: new Container(
    color: Colors.lightBlue,
    width: 200.0,
    height: 200.0,

    ),
    )
    );
    }
    }