我想從 snapshot.data!.sections![i].checklists 中獲取每個專案的名稱!.map((e) => e.quesito 并將其轉換為每個專案的 Text (' '),但我目前沒有找到解決方案,我無法獲得我的 SwitchListTile 的標題...
ListView.builder(
physics: const NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemCount: 6,
itemBuilder: (context, i) {
return Column(
children: <Widget>[
Container(
width: double.infinity,
padding:
const EdgeInsets.only(left: 15),
color: Colors.grey[200],
child: Row(
children: [
Text(
'${snapshot.data!.secoes![i].nome}',
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold),
),
const SizedBox(
height: 30,
),
],
),
),
...snapshot.data!.secoes![i].checklists!
.map<Widget>(
(e) => SwitchListTile(
title: Text(''),
value: true,
onChanged: (bool newValue) {},
),
),
],
);
},
),
uj5u.com熱心網友回復:
如果你確定你已經決議了資料,你可以簡單地從地圖中呼叫資料。
...snapshot.data!.secoes![i].checklists!
.map<Widget>(
(e) => SwitchListTile(
title: Text(e.quesito),
value: true,
onChanged: (bool newValue) {},
),
),
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/430805.html
