import 'package:flutter/material.dart';
void main()=>runApp(MyApp(
list :new List<String>.generate(46, (i)=>'我是列表 $i')
));
class MyApp extends StatelessWidget{
final List<String> list;
MyApp({Key key,@required this.list}):super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
title: '动态表格',
home: new Scaffold(
appBar: new AppBar(
title: Text('动态表格组件'),
),
body: new ListView.builder(
itemCount: list.length,
itemBuilder: (context,index){
return new ListTile(
title: Text(list[index]),
);
},
),
),
);
}
}
网友评论