flutter 长列表
import ‘package:flutter/foundation.dart‘;
import ‘package:flutter/material.dart‘;
void main() {
runApp(new MyApp(
items: new List<String>.generate(10000, (i) => "Item $i"),
));
}
class MyApp extends StatelessWidget {
final List<String> items;
MyApp({Key key, @required this.items}) : super(key: key);
@override
Widget build(BuildContext context) {
final title = ‘Long List‘;
return new MaterialApp(
title: title,
home: new Scaffold(
appBar: new AppBar(
title: new Text(title),
),
body: new ListView.builder(
itemCount: items.length,
itemBuilder: (context, index) {
return new ListTile(
title: new Text(‘${items[index]}‘),
);
},
),
),
);
}
} 相关推荐
csdnYF 2020-11-15
SemiraChen 2020-10-10
YejiaSun 2020-09-27
csdnYF 2020-09-20
FrankAbagnale 2020-09-15
wmd看海 2020-07-27
szintu 2020-07-05
chaoxiao 2020-07-04
wmd看海 2020-06-27
龙衣 2020-06-26
龙衣 2020-06-09
龙衣 2020-06-08
wmd看海 2020-06-04
Samlss 2020-06-04
wmd看海 2020-06-04
csdnYF 2020-05-30
androidgjw 2020-05-28
wmd看海 2020-05-28
wmd看海 2020-05-19