Class ItemSlotArea


public class ItemSlotArea extends RenderObjectWidget
Binds a consecutive row-major area of a grid to existing container indexes, read-only by default. Paging changes firstIndex, never container contents or lifetime. A partial last page leaves the remaining grid slots unbound. Use it as a layout child with its own startSlot, not as a single GridView cell (a cell assigns one position to its render object).
ItemSlotArea.builder(container).firstIndex(page * 9).count(9).build(); // VIEW
ItemSlotArea.builder(container).count(9).mode(BindingMode.EDITABLE).build(); // Explicit opt-in
Since:
7.0.0
  • Field Details

    • container

      private final SlotContainer container
    • firstIndex

      private final int firstIndex
    • count

      private final int count
    • startSlot

      private final int startSlot
    • mode

      private final BindingMode mode
  • Constructor Details

  • Method Details

    • builder

      public static ItemSlotArea.Builder builder(SlotContainer container)
      Parameters:
      container - the container whose contents are shown @return a new builder
    • getContainer

      public SlotContainer getContainer()
      Returns:
      the bound container
    • getFirstIndex

      public int getFirstIndex()
      Returns:
      the first visible container index
    • getCount

      public int getCount()
      Returns:
      the requested area size, possibly exceeding the remaining container indexes
    • getStartSlot

      public int getStartSlot()
      Returns:
      the first grid slot
    • getMode

      public BindingMode getMode()
      Returns:
      the binding's edit/view mode
    • createElement

      @NotNull public @NotNull RenderObjectElement createElement()
      Description copied from class: Widget
      Creates the Element corresponding to this Widget.

      This is a framework-internal method; subclasses should return the Element implementation appropriate to the Widget type.

      Specified by:
      createElement in class RenderObjectWidget
      Returns:
      the corresponding Element instance