我正在使用自定义滚动视图进行滚动。我想创建一个slipplist,其中一个容器有一个slipplist长度。
这是我想要达到的画面
下面是我的JSON API响应
{
"getNotices": [
{
"id": "d7dc04b4-725a-407d-93b8-eff16de84c4d",
"title": "Result Published! First annual Examination result was published",
"description": "<p>Dear all,<br></p><p>In celebration of Eid Al-Fitr, our office will be closed from [date] to [date]. We will resume our regular business hours on [date].</p><p>We would like to take this opportunity to wish all of our Muslim colleagues and clients a blessed and joyous Eid Al-Fitr. May this occasion bring you and your loved ones happiness, peace, and prosperity.</p><p>Please note that any urgent matters can still be directed to [contact person or department]. We apologize for any inconvenience this may cause and appreciate your understanding.</p><p>Thank you.</p><p>[Your Name or Company Name]</p>",
"pdf": "student/1payUwKS69AHX9pxVEv35E.pdf",
"created_at": "2023-05-05T14:34:57.739Z"
},
{
"id": "c97a3228-2fd6-4903-9cc9-127994b65f96",
"title": "Upcoming Eid Holiday and Summer Holiday announcement!",
"description": "<p>Dear Student,</p><p>In celebration of Eid Al-Fitr, our schooll will be closed from 12 April to 30 April. We will resume our regular class hours on 31 April.</p><p>We would like to take this opportunity to wish all of our Muslim colleagues and clients a blessed and joyous Eid Al-Fitr. May this occasion bring you and your loved ones happiness, peace, and prosperity.</p><p>Please note that any urgent matters can still be directed to [contact person or department]. We apologize for any inconvenience this may cause and appreciate your understanding.</p><p>Thank you.</p><p>My School Name</p>",
"pdf": "student/25pLxKS1eKrbzucstF8cRv.pdf",
"created_at": "2023-05-05T14:01:30.577Z"
}
]
}
我怎么能建立这个?
1条答案
按热度按时间izkcnapc1#
要创建一个由List长度决定项数的SliverList,可以使用ListView.builder构造函数。下面是一个如何执行此操作的示例:
CustomScrollView( slivers:[ SliverList( delegate:SliverChildBuilderDelegate((BuildContext context, int index){return Container(// your widget here);},childCount: yourList.length, ),),],)