Flutter ListView.builder

Flutter ListView
Flutter ListView
import 'package:flutter/material.dart';

void main() {
  runApp(MaterialApp(home: HomePage()));
}

class HomePage extends StatelessWidget {
  final list = [
    'Jean',
    'Pierre',
    'Jacques',
    'Joel',
    'Marcelin',
    'Francois',
    'Carmel',
    'Lucita',
    'Flona'
        'Herard',
    'China',
    'Elice',
    'Claudette',
    'Nahomie',
    'Juliana',
    'Corel',
    'Jeanne',
    'Ginette',
    'Fabienne',
    'Nicole',
    'Chalienne',
    'Richena',
    'Jolia',
    'Trina'
  ];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text('Mon application Flutter')),
      body: ListView.builder(
        itemCount: list.length,
        itemBuilder: (BuildContext context, index) {
          return ListTile(
            title: Text(list[index]),
            subtitle: Text(list[index]),
            leading: CircleAvatar(backgroundColor: Colors.yellow),
          );
        },
      ),
    
    );
  }
}

Laisser un commentaire