꿈꾸는 시스템 디자이너

Flutter Example - ListView | Create ListView with builder 본문

Tutorial/Flutter with App

Flutter Example - ListView | Create ListView with builder

독행소년 2019. 9. 27. 14:32
import 'package:flutter/material.dart';

class ListViewWidthBuilder extends StatelessWidget {
  
  List<String> items;

  ListViewWidthBuilder() {
    items = List<String>.generate(100, (index) {
      return "Item - $index";
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text("ListView with builder")),
      body: ListView.builder(itemBuilder: (context,index){
        String item = items[index];
        return ListTile(
          title: Text(item)
        );
      })
    );
  }
}

 

 

▶ Go to Table of Contents | 강의 목차로 이동


※ This example is also available in the Flutter Code Examples app. | 본 예제는 Flutter Code Examples 앱에서도 제공됩니다.

 

Flutter Code Examples - Google Play 앱

Are you a beginner at Flutter? Check out the various features of Flutter through the demo. Source code for all demos is also provided.

play.google.com

Comments