onCollapsedRatioChanged method
void
onCollapsedRatioChanged()
Implementation
void onCollapsedRatioChanged() {
if (getScrollController().positions.isEmpty) return;
double startBarExtent = !_widgetIsReverse
? _appBarController!.appBarExpandExtent
: _appBarController!.bottomBarExpandExtent;
double startBarNowCollapsedExtent =
startBarExtent * _appBarController!.collapsedRatio.value;
double pixels = getScrollController().position.pixels;
double minScrollExtent = getScrollController().position.minScrollExtent;
double listScrollOffsetFromMin = pixels - minScrollExtent;
if (listScrollOffsetFromMin <= startBarExtent &&
(listScrollOffsetFromMin - startBarNowCollapsedExtent).abs() > 2) {
getScrollController()
.position
// ignore: invalid_use_of_protected_member
.forcePixels(minScrollExtent + startBarNowCollapsedExtent);
}
}