GridLayout class

This simple layout places all of the Parts in a grid-like arrangement, ordered, spaced apart, and wrapping as needed. It ignores any Links connecting the Nodes being laid out. There are many samples that use GridLayout. Every Palette uses a GridLayout by default.

If you want to experiment interactively with most of the properties, try the Grid Layout sample. See samples that make use of GridLayout in the samples index.

By default this layout will sort all of the Parts alphabetically (comparing Part#text values, respecting case) and position them left-to-right, separated by #spacing.width, until they do not fit in the current row. At that time it starts a new row, separated from the previous row by #spacing.height. There is a uniform cell size equal to the maximum Part width (plus spacing width) and the maximum part height (plus spacing height). At least one part is placed in each row, even if the part by itself is wider than the wrapping width.

You can specify values for the #cellSize width and height. If a part is wider than the cell size, it spans more than one cell in the row. You can also specify a value for the #wrappingWidth, which will be used instead of the diagram's viewport width, to control when each row is considered "full". The value of Layout#isViewportSized will be true when the value of #wrappingWidth is NaN. This causes the layout to be performed again automatically as the viewport changes size.

You can also set #wrappingColumn to limit the number of items in each row. Both the #wrappingWidth and the #wrappingColumn are respected when deciding when to wrap to the next row.

This layout is sufficiently simple that it does not use a LayoutNetwork.

Implemented types
Available extensions
Annotations
  • @JS()
  • @staticInterop

Constructors

GridLayout([dynamic init])
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

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

Static Properties

ascending EnumValue
Lay out each child according to the sort order given by GridLayout#comparer This value is used for GridLayout#sorting.
getter/setter pair
descending EnumValue
Lay out each child in reverse sort order given by GridLayout#comparer This value is used for GridLayout#sorting.
getter/setter pair
forward EnumValue
Lay out each child in the order in which they were found; This value is used for GridLayout#sorting.
getter/setter pair
leftToRight EnumValue
Fill each row from left to right; This value is used for GridLayout#arrangement.
getter/setter pair
location EnumValue
Position the part's Part#location at a grid point; This value is used for GridLayout#alignment.
getter/setter pair
position EnumValue
Position the top-left corner of each part at a grid point; This value is used for GridLayout#alignment.
getter/setter pair
reverse EnumValue
Lay out each child in reverse order from which they were found; This value is used for GridLayout#sorting.
getter/setter pair
rightToLeft EnumValue
Fill each row from right to left; This value is used for GridLayout#arrangement.
getter/setter pair