The property is the data which you want to show in section view. Notice, the data is two hierarchical data. Section view will use the data to render header item and list item both. like: List and Country should have a "provinces" property. Please ref [Source example]
- type:
List<T>
// source model example
class Country {
Country(
{required this.name, required this.abbreviate, required this.provinces});
String name;
String abbreviate;
List<String> provinces;
}Get the list to render list item. The parameter "sourceItem" is item of source.
- type
List<N> Function(T sourceItem)
// example
onFetchListData: (country) => country.provincesBuilding header widget.
- type
Widget Function(BuildContext context, T headerData, int headerIndex)
// example
headerBuilder: (context, headerData, headerIndex) =>
Container(
color: const Color(0xFFF3F4F5),
child: Padding(
padding: const EdgeInsets.all(12.0),
child: Text(
headerData.name,
style: const TextStyle(
fontSize: 18, color: Color(0xFF767676)),
),
),
),- parameter
- headerData: The item of source
- headerIndex: The item index in source
- type
Widget Function(
BuildContext context,
N itemData,
int itemIndex,
T headerData,
int headerIndex,
);
// example
itemBuilder:
(context, itemData, itemIndex, headerData, headerIndex) =>
ListTile(title: Text(itemData))),