首页 > 解决方案 > 如何使用图像 Flutter 创建简单的 Listview

问题描述

我想知道如何实现与此 图像相似或接近的东西,而不是使用卡片,任何示例代码都会受到高度赞赏

标签: flutteruser-interfacelayout

解决方案


试试这个代码

    ListView.builder(
              itemCount: 2,
              itemBuilder: (BuildContext context, int index) {
                return Column(
                  mainAxisSize: MainAxisSize.min,
                  children: <Widget>[
                    Row(
                      children: <Widget>[
                        SizedBox(width: 10.0),
                        Image.asset(
                          'Your Asset',
                          height: 100,
                        ),
                        SizedBox(width: 20.0),
                        Expanded(
                          child: Column(
                            crossAxisAlignment: CrossAxisAlignment.start,
                            mainAxisSize: MainAxisSize.min,
                            children: <Widget>[
                              Text(
                                'Title Here',
                                style: TextStyle(
                                  color: Colors.black,
                                  fontSize: 18.0,
                                  fontWeight: FontWeight.w500,
                                ),
                              ),
                              SizedBox(width: 6.0),
                              Text(
                                'Subtitle Here',
                                style: TextStyle(
                                  color: Colors.black,
                                  fontSize: 15.0,
                                  fontWeight: FontWeight.w300,
                                ),
                              ),
                            ],
                          ),
                        ),
                      ],
                    ),
                    Divider(
                      color: Colors.black,
                      thickness: 1.5,
                    ),
                  ],
                );
              },
            ),

推荐阅读