颤振中的自定义卡布局

时间:2020-04-08 04:19:25

标签: flutter dart flutter-layout

我要创建自定义卡片布局或iPad和平板电脑

enter image description here

这是到目前为止我编写的代码

Widget _buildListItem(BuildContext context) {
return new Container(
    child: ListView(
  children: <Widget>[
    Card(
      elevation: 2,
      child: ClipPath(
        child: Container(
            height: 70,
            decoration: BoxDecoration(
                border: Border(
                    right:
                        BorderSide(color: Colors.lightGreen, width: 30))),
            child: Container(
              height: 70,
              child: Container(
                  alignment: Alignment(1.16, 0),
                  child: Icon(
                    Icons.arrow_forward_ios,
                    color: Colors.black,
                    size: 24.0,
                    semanticLabel: 'wweqweqwe',
                  )),
            )),
        clipper: ShapeBorderClipper(
            shape: RoundedRectangleBorder(
                borderRadius: BorderRadius.circular(3))),
      ),
    )
  ],
));

} }

我是新手,请帮助我构建这个。

1 个答案:

答案 0 :(得分:1)

尝试一下

Container(
                          height: 60,
                          width: MediaQuery.of(context).size.width,
                          decoration: BoxDecoration(
                              borderRadius: BorderRadius.circular(15.0),
                              color: Colors.white),
                          child: Container(
                            child: Row(
                              children: <Widget>[
                                Container(
                                    height: 60,
                                    width: 50,
                                    decoration: BoxDecoration(
                                        borderRadius: BorderRadius.only(
                                          topLeft: Radius.circular(15),
                                          bottomLeft: Radius.circular(15),
                                        ),
                                        color: Colors.blue),
                                    child: Icon(
                                      Icons.arrow_forward_ios,
                                      color: Colors.black,
                                      size: 24.0,
                                      semanticLabel: 'wweqweqwe',
                                    )),
                                Expanded(
                                    child: Container(
                                      color: Colors.red,
                                      height: 60,
                                      padding: EdgeInsets.all(5.0),
                                      child: Row(
                                        mainAxisAlignment:
                                        MainAxisAlignment.spaceBetween,
                                        mainAxisSize: MainAxisSize.min,
                                        crossAxisAlignment:
                                        CrossAxisAlignment.center,
                                        children: <Widget>[
                                          Text('Text One'),
                                          Column(
                                            crossAxisAlignment:
                                            CrossAxisAlignment.center,
                                            mainAxisSize: MainAxisSize.min,
                                            children: <Widget>[
                                              Text('Text Two'),
                                              Text('Text Three'),
                                            ],
                                          )
                                        ],
                                      ),
                                    )),
                                Container(
                                    height: 60,
                                    width: 30,
                                    decoration: BoxDecoration(
                                        borderRadius: BorderRadius.only(
                                          topRight: Radius.circular(15),
                                          bottomRight: Radius.circular(15),
                                        ),
                                        color: Colors.blue),
                                    child: Icon(
                                      Icons.arrow_forward_ios,
                                      color: Colors.black,
                                      size: 24.0,
                                      semanticLabel: 'wweqweqwe',
                                    )),
                              ],
                            ),
                          ))

输出

enter image description here