calculateListPadding method

double calculateListPadding(
  1. BoxConstraints constraint
)

Calculate List Padding by checking SelectedItemAnchor

Implementation

double calculateListPadding(BoxConstraints constraint) {
  switch (widget.selectedItemAnchor) {
    case SelectedItemAnchor.MIDDLE:
      return (widget.scrollDirection == Axis.horizontal
                  ? constraint.maxWidth
                  : constraint.maxHeight) /
              2 -
          widget.itemSize / 2;
    case SelectedItemAnchor.END:
      return (widget.scrollDirection == Axis.horizontal
              ? constraint.maxWidth
              : constraint.maxHeight) -
          widget.itemSize;
    case SelectedItemAnchor.START:
    default:
      return 0;
  }
}