Position class Core Layout
Represents a 2D position with a defined positioning mode.
A Position stores horizontal (x) and vertical (y) offsets, along with a PositionType that determines whether the offsets are interpreted as absolute coordinates or relative to a parent element.
This is commonly used for placing components within a container or specifying fixed positions in a terminal or layout system.
Example:
// Absolute position at (10, 5)
final pos1 = Position(
x: 10,
y: 5,
positionType: PositionType.absolute,
);
// Relative position offset by (2, -1) from a parent reference point
final pos2 = Position(
x: 2,
y: -1,
positionType: PositionType.relative,
);
See also:
- PositionType for available positioning modes
- Component.position for component placement
Constructors
- Position.new({required int x, required int y, required PositionType positionType})
-
Creates a Position with the given
x
,y
, andpositionType
.const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- positionType → PositionType
-
The positioning mode that determines how x and y are interpreted.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- x → int
-
The horizontal offset from the origin or reference point.
final
- y → int
-
The vertical offset from the origin or reference point.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited