简体   繁体   中英

How to populate custom widget items into listview in flutter?

在此处输入图像描述

I want to create listview like this image. How can I achieve this using flutter?

Please do a favour if you know how to make it?

You need a List view widget and with builder which contains a card widget which has Row as child.

ListView:-

ListView.builder(
        padding: EdgeInsets.all(10.0),
        shrinkWrap: false,
        itemCount: model.length,
        itemBuilder: (BuildContext context, int index) {
          return listItem(context, index);
        },

List item:-

model is removed

Widget listItem(BuildContext context, int index) {
  return Card(
  child: Row(
    children: <Widget>[

      Container(margin: EdgeInsets.all(10),child: Text("1")),
      Container(height: 20,width: 1,color: Colors.blue,),
      Container(margin:EdgeInsets.all(10),child: Text("asdasd"))
    ],
  ),
);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM