setHeaderExtent method
Set the extent of a specific header
Implementation
SwayzeHeaderState setHeaderExtent(int index, double extent) {
final currentHeaderData = _customSizedHeaders[index];
final _newCustomSizedHeaders =
SplayTreeMap<int, SwayzeHeaderData>.from(_customSizedHeaders);
if (extent == defaultHeaderExtent) {
_newCustomSizedHeaders.remove(index);
} else if (currentHeaderData == null) {
_newCustomSizedHeaders[index] = SwayzeHeaderData(
index: index,
extent: extent,
hidden: false,
);
} else {
_newCustomSizedHeaders[index] =
currentHeaderData.copyWith(extent: extent);
}
return SwayzeHeaderState._fromSortedHeaderData(
elasticCount: elasticCount,
defaultHeaderExtent: defaultHeaderExtent,
count: count,
sortedHeaderData: _newCustomSizedHeaders,
frozenCount: frozenCount,
);
}