:::

6-5 從遠端抓資料後,塞入可延伸的 ListView 中

Expanded(
  child: FutureBuilder(
    future: getCountriesData(),
    builder: (BuildContext context, AsyncSnapshot snap) {
      if (snap.hasData) {
        Response res = snap.data;
        return ListView.builder(
          itemCount: res.data.length,
          itemBuilder: (context, index) {
            Map<String, dynamic> data = res.data[index];
            return ListTile(
              title: Row(
                children: [
                  Expanded(
                      child: Text()),
                  Text(),
                ],
              ),
            );
          },
        );
      } else {
        return Center(
          child: CircularProgressIndicator(),
        );
      }
    },
  ),
),

 


:::

書籍目錄

展開 | 闔起

快速登入


https%3A%2F%2Fcampus-xoops.tn.edu.tw%2Fmodules%2Ftad_book3%2Fpage.php%3Ftbdsn%3D1889%26tbsn%3D42

計數器

今天: 3366336633663366
昨天: 2489248924892489
總計: 8025348802534880253488025348802534880253488025348