getPadding method Null safety

EdgeInsets getPadding(
  1. int index,
  2. int total
)

Returns the standard padding for a button at index out of a total number of buttons.

Standard Material TextSelectionToolbars have buttons with different padding depending on their position in the toolbar.

Implementation

static EdgeInsets getPadding(int index, int total) {
  assert(total > 0 && index >= 0 && index < total);
  final _TextSelectionToolbarItemPosition position = _getPosition(index, total);
  return EdgeInsets.only(
    left: _getLeftPadding(position),
    right: _getRightPadding(position),
  );
}