import 'package:flutter/material.dart';
void main()=>runApp(Myapp(
items:new List<String>.generate(1000, (i)=>"items $i")
));
class Myapp extends StatelessWidget{
//接受参数
List<String> items;
Myapp({Key key,@required this.items}):super(key: key);
@override
Widget build(BuildContext context) {
// TODO: implement build
return MaterialApp(
title: "这是一个flutterAPP",
home: Scaffold(
appBar: new AppBar(
title: new Text("这是app"),
),
body:new ListView.builder(
itemCount: items.length,
itemBuilder: (context,index){
return new ListTile(
title: new Text(
"${items[index]}"
),
);
},
)
),
);
}
}
flutter动态ListView
最新推荐文章于 2024-04-17 16:09:07 发布