addSlot method

void addSlot(
  1. T? item, {
  2. bool update = true,
})

Implementation

void addSlot(T? item, {bool update = true}) {
  final index = _relationship.length;
  final Rect rect = calcSlotRect(index: index, layoutWidth: layoutWidth);
  final slot = _createSlot(index: index, item: item, rect: rect);
  final child = _createItem(index: index, item: item, rect: rect);
  _relationship[slot] = child;

  if (mounted && update) {
    _updateSlots();
    setState(() {});
    widget.onChanged?.call(items);
  }
}