- 创建一个新部件文件
post_this_item.dark
用于列表项目。 - 定义小部件
post_mr_item
,拥有类型为post且名为item的属性。 - 为
post_mr_item
添加构造方法,并使用requires
确保使用时必须提供item参数。 - 使用Container小部件设置padding,并只在bottom边缘添加边距。
- 将之前剪切的Text小部件粘贴进来,并将文字内容替换为item数据。
- 在列表视图
post_list_your.dart
中,item builder现在返回post_list_item
部件,需要传入一个post数据作为item参数。 - 应用的界面上继续显示内容标题的列表。