updateScrollbarPainter method

  1. @override
void updateScrollbarPainter(
  1. bool vertical
)
override

This method is responsible for configuring one scrollbarPainter according to the widget's properties and any inherited widgets the painter depends on, like Directionality and MediaQuery.

This method is called by updateScrollbarPainters for each scrollbarPainter. Subclasses can override to configure the scrollbarPainter.

Implementation

@override
void updateScrollbarPainter(bool vertical) {
  PublicScrollbarPainter scrollbarPainter =
      vertical ? verticalScrollbar : horizontalScrollbar;

  scrollbarPainter
    ..color = getThumbColor(isVertical: vertical)
        .resolve(vertical ? _statesV : _statesH)
    ..trackColor = vertical
        ? _trackColorV.resolve(_statesV)
        : _trackColorH.resolve(_statesH)
    ..trackBorderColor = vertical
        ? _trackBorderColorV.resolve(_statesV)
        : _trackBorderColorH.resolve(_statesH)
    ..textDirection = Directionality.of(context)
    ..thickness = vertical
        ? _thicknessV.resolve(_statesV)
        : _thicknessH.resolve(_statesH)
    ..radius = radius ??
        _scrollbarTheme.radius ??
        (_useAndroidScrollbar ? null : _kScrollbarRadius)
    ..crossAxisMargin = _scrollbarTheme.crossAxisMargin ??
        (_useAndroidScrollbar ? 0.0 : _kScrollbarMargin)
    ..mainAxisMargin = _scrollbarTheme.mainAxisMargin ?? 0.0
    ..minLength = _scrollbarTheme.minThumbLength ?? _kScrollbarMinLength
    ..padding = MediaQuery.paddingOf(context)
    ..ignorePointer = !enableGestures;
}