LayoutItem class

A single, immutable source of truth for a dashboard item's properties.

It represents the grid position (x, y), dimensions (w, h), constraints, and behavior flags (isStatic, isDraggable, etc.).

Annotations

Constructors

LayoutItem({required String id, required int x, required int y, required int w, required int h, int minW = 1, int minH = 1, double maxW = double.infinity, double maxH = double.infinity, bool? isDraggable, bool? isResizable, bool isStatic = false, bool moved = false, bool isSectionBarrier = false, String? sectionTitle, bool hasNestedGrid = false, bool isDropTarget = false, Map<String, dynamic>? extra})
Creates a new LayoutItem.
const
LayoutItem.fromMap(Map<String, dynamic> map)
Creates a LayoutItem from a JSON-serializable map.
factory

Properties

contentSignature → int
Returns a hash code representing the visual content of the item. This excludes position (x, y) and transient state (moved). Used to determine if the widget needs to be rebuilt.
no setter
extra → Map<String, dynamic>?
Free-form, JSON-serializable business metadata carried by the item (widget type, title, color, configuration…). Travels through toMap/fromMap — so exportLayout/exportNestedTree persist layout AND configuration in one payload — and through copyWith. Compared with SHALLOW map equality: replace the map instance to change it, do not mutate it in place (mutations are invisible to change detection). Included in contentSignature, so changing extra rebuilds the item's cached widget; never consulted during drags.
final
h → int
The height of the item in grid units.
final
hashCode → int
The hash code for this object.
no setteroverride
hasNestedGrid → bool
Whether this item hosts a nested dashboard (a NestedDashboard in its content).
final
id → String
The unique identifier for the layout item.
final
isDraggable → bool?
If true, the item can be dragged. Overrides the layout's isDraggable.
final
isDropTarget → bool
Marks this item as a direct DROP TARGET for dragged items, without hosting a visible nested grid.
final
isResizable → bool?
If true, the item can be resized. Overrides the layout's isResizable.
final
isSectionBarrier → bool
Whether this item represents a static visual section barrier (header).
final
isStatic → bool
If true, the item is static and cannot be moved or resized by user interaction. It also won't be moved by compaction or collisions.
final
maxH → double
The maximum height of the item in grid units. Defaults to double.infinity.
final
maxW → double
The maximum width of the item in grid units. Defaults to double.infinity.
final
minH → int
The minimum height of the item in grid units. Defaults to 1.
final
minW → int
The minimum width of the item in grid units. Defaults to 1.
final
moved → bool
A flag to indicate if the item has been moved during a drag operation.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
sectionTitle → String?
The text title of the section if isSectionBarrier is true.
final
w → int
The width of the item in grid units.
final
x → int
The x-coordinate of the item in grid units.
final
y → int
The y-coordinate of the item in grid units.
final

Methods

copyWith({String? id, int? x, int? y, int? w, int? h, int? minW, int? minH, double? maxW, double? maxH, bool? isDraggable, bool? isResizable, bool? isStatic, bool? moved, bool? isSectionBarrier, String? sectionTitle, bool? hasNestedGrid, bool? isDropTarget, Map<String, dynamic>? extra}) → LayoutItem
Creates a new LayoutItem with updated properties.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toMap() → Map<String, dynamic>
Converts the LayoutItem to a JSON-serializable map.
toString() → String
A string representation of this object.
override

Operators

operator ==(Object other) → bool
The equality operator.
override