:::

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(),
        );
      }
    },
  ),
),

 


:::

書籍目錄

展開 | 闔起

快速登入


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

計數器

今天: 1244124412441244
昨天: 8625862586258625
總計: 8031851803185180318518031851803185180318518031851