Answers for "create listview flutter"

9

flutter listview builder

List<String> litems = ["1","2","Third","4"];
body: new ListView.builder
  (
    itemCount: litems.length,
    itemBuilder: (BuildContext ctxt, int index) {
     return new Text(litems[index]);
    }
  )
Posted by: Guest on June-18-2020
2

listview flutter

ListView.builder(
          itemCount: data.length,
          itemBuilder: (context, index) {
            return Padding(
              padding: const EdgeInsets.symmetric(vertical: 1, horizontal: 4),
              child: Card(
                child: ListTile(
                  onTap: () {
                    print(data[index]);
                  },
                  title: Text(data[index].name),
                  leading: CircleAvatar(
                    backgroundImage:
                        AssetImage('assets/${data[index].avatar}'),
                  ),
                ),
              ),
            );
          }),
Posted by: Guest on September-20-2021
1

listview in flutter

ListView(
  padding: const EdgeInsets.all(8),
  children: <Widget>[
    Container(
      height: 50,
      color: Colors.amber[600],
      child: const Center(child: Text('Entry A')),
    ),
    Container(
      height: 50,
      color: Colors.amber[500],
      child: const Center(child: Text('Entry B')),
    ),
    Container(
      height: 50,
      color: Colors.amber[100],
      child: const Center(child: Text('Entry C')),
    ),
  ],
)
Posted by: Guest on March-28-2020

Browse Popular Code Answers by Language