Pin class

Defines a pinned layout along a single axis (horizontal or vertical). Used with (and by) the Pinned layout widget. In most cases, it's easiest to think of a Pin as defining the position of the starting and ending edges of the child. So, for a horizontal Pin, start maps to left, and end maps to right.

Each edge can be defined relative to the enclosing parent's dimensions, or relative to the opposite edge. Both absolute (eg. "pixel") values, and fractional (eg. "percentage") values can be used.

The start and end parameters specify a pixel inset from the parent dimensions. Ex. A horizontal pin defined as Pin(start: 20.0, end: 30.0), laying out a child in a parent that is 200 wide would position the child with its left edge at 20, and its right edge at 170 (ie. 200 - 30).

The startFraction and endFraction parameters specify an inset as a fraction of the parent dimensions. Ex. A horizontal pin defined as Pin(startFraction: 0.15, endFraction: 0.2), laying out a child in a parent that is 200 wide would position the child with its left edge at 30 (ie. 0.15 * 200), and its right edge at 160 (ie. 200 - 0.2 * 200).

The size parameter can be paired with either a single edge parameter (see above), or middle (see below) to set a pixel size for the child. Ex. a horizontal pin defined as Pin(startFraction: 0.3, size: 70.0) in a 200 wide parent, would position the child with its left edge at 60 (ie. 0.3 * 200), and right edge at 130 (ie. 60 + 70).

Finally, the middle parameter is paired with the size parameter to position the child based on a fraction of the remaining size in the parent. Ex. Given a horizontal pin defined as Pin(size: 80.0, middle: 0.5) in a parent 200 wide, the remaining size would be 120 (ie. 200 - 80). The left edge would be positioned at 60 (ie. 120 * 0.5), and the right edge at 240 (ie. 60 + 80), centering it in the available space.

Annotations

Constructors

Pin({double? start, double? startFraction, double? end, double? endFraction, double? size, double? middle})

Properties

end double?
final
endFraction double?
final
hashCode int
The hash code for this object.
no setteroverride
middle double?
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
size double?
final
start double?
final
startFraction double?
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

operator ==(dynamic other) bool
Compares two Pins for equality.
override