presentation/widgets/common/inventory_grid library

Classes

AnimatedInventoryGrid
Animated variant of InventoryGrid with pop-in scale for newly added items and smooth sliding transitions on slot reorders.
InventoryGrid
A data-driven grid over an InventorySnapshot — like QuestViewModel/ LeaderboardEntry, this widget holds no game logic or catalog of its own; itemBuilder is the caller's own renderer (item icon, rarity frame, stack count, equipped badge — this package doesn't ship a concrete item catalog, see ItemDefinition's doc), and a tap never mutates anything here — the caller's own tap handler is expected to call InventoryService.consume/setEquipped/moveSlot itself.

Functions

inventoryGridCellDelta({required int oldIndex, required int newIndex, required int crossAxisCount, required double cellSize, required double spacing}) → Offset
Calculates the layout translation delta between oldIndex and newIndex.
inventoryGridCellOffset({required int index, required int crossAxisCount, required double cellSize, required double spacing}) → Offset
Calculates the top-left offset of a grid cell relative to the grid origin.

Typedefs

InventoryItemBuilder = Widget Function(BuildContext context, InventorySlot slot, bool isSelected)
Renders one filled cell — isSelected reflects InventoryGrid.selectedSlotId so the caller decides how to highlight it (this widget holds no selection state of its own, see class doc).
InventoryPlaceholderBuilder = Widget Function(BuildContext context, int cellIndex)
Renders one non-item cell (empty or locked) at cellIndex (0-based, stable across rebuilds as long as InventoryGrid.unlockedCapacity doesn't change).