Flutter List Map 循环

7 min read
class _MyHomePageState extends State<MyHomePage> {

  List listData=["第一条数据","第二条数据","第三条数据","第四条数据","第五条数据"];
//  Map map
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text('Map渲染界面'),),
      body: SingleChildScrollView(
        child: Column(
          children:_listView(),
        ),
      ),
    );
  }

  List<Widget> _listView(){
    return listData.map((f)=>Text(f)).toList();
  }
}