:::

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

計數器

今天: 618618618
昨天: 3068306830683068
總計: 8077123807712380771238077123807712380771238077123