setWidgetProperties method

void setWidgetProperties(
  1. bool reverse,
  2. ScrollController? controller
)

Implementation

void setWidgetProperties(bool reverse, ScrollController? controller) {
  _widgetIsReverse = reverse;
  _widgetScrollController = controller;

  if (_widgetScrollController != null) {
    _scrollController?.dispose();
    _scrollController = null;
  } else {
    _scrollController ??= ScrollController();
  }

  // if this scrollController is not attached yet,
  // it means this scrollable view is being constructed now,
  // and we want to set the initial scrollOffset if the app bar collapsed
  if (getScrollController().positions.isEmpty) {
    WidgetsBinding.instance.addPostFrameCallback((_) {
      onCollapsedRatioChanged();
    });
  }
}