docs: protected int adjustIndex(Widget child, int beforeIndex) {
  
          checkIndexBoundsForInsertion(beforeIndex);
  
          // Check to see if this widget is already a direct child.
          if (child.getParent() == this) {
              // If the Widget's previous position was left of the desired new position
              // shift the desired position left to reflect the removal
              int idx = getWidgetIndex(child);
              if (idx < beforeIndex) {
                  beforeIndex--;
              }
          }
  
          return beforeIndex;
      }