//flutter import 'package:flutter/material.dart'; void main() { return runApp(TestPage()); } //リスト4.27 class TestPage extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( title: 'ListView', home: Scaffold( appBar: AppBar(title: Text('ListView')), body: HogeListWidget() ) ); } } class HogeListWidget extends StatefulWidget { @override State<HogeListWidget> createState() => _HogeListWidgetState(); } class _HogeListWidgetState extends State<HogeListWidget> { final itemList = List.generate(500, (i) => 'Item$i'); @override Widget build(BuildContext context) { return ListView.separated( itemCount: itemList.length, itemBuilder: (context, index) { return Text(itemList[index]); }, separatorBuilder: (context, index) { return Divider(height: 1); } ); } }