LayoutUtils class

Utility class for layout operations in GraphX.

Provides methods for laying out display objects in columns, rows, and grids, as well as for resizing and positioning display objects within a container.

Constructors

LayoutUtils()
Factory constructor to ensure exception. Throws an exception if an attempt is made to instantiate this class.
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

debugColor Color
Debug color for visualizing layout bounds
getter/setter pair

Static Methods

col(List<GDisplayObject> items, {double gap = 0, double startX = 0, double startY = 0, double width = 0, double height = 0, MainAxisAlignment axisAlign = MainAxisAlignment.start, CrossAxisAlignment crossAlign = CrossAxisAlignment.start, bool mask = false, bool debug = false}) → void
Arranges the items vertically in a single column, similar to Flutter's Column, with optional gap between them. The column will start at the startX and startY position. The width and height of the column can be specified, but at least one of them must be greater than 0. The axisAlign parameter controls how the items are aligned along the vertical axis, while the crossAlign parameter controls how they are aligned along the horizontal axis. If mask is set to true, the parent container of the items will be clipped to the specified width and height. If debug is set to true, a red rectangle will be drawn around the column for debugging purposes.
grid(List<GDisplayObject> items, {double gapX = 0, double gapY = 0, int rows = 0, required int cols, double width = 0, double height = 0, double startX = 0, double startY = 0}) → void
Simplistic grid approach that requires you pass the amount of cols.
objectFit(GDisplayObject object, {BoxFit fit = BoxFit.cover, double? objW, double? objH, required double canvasW, required double canvasH, bool reposition = false}) → void
Resizes and positions object inside a container defined by canvasW and canvasH. If objW and objH are provided, they should be the original size of the asset. The fit parameter works similar to BoxFit in Flutter. If reposition is true, the object will be centered in the container after resizing.
row(List<GDisplayObject> items, {double gap = 0, double startX = 0, double startY = 0, double width = 0, double height = 0, MainAxisAlignment axisAlign = MainAxisAlignment.start, CrossAxisAlignment crossAlign = CrossAxisAlignment.start, bool mask = false, bool debug = false}) → void
Arranges the items horizontally in a single row, similar to Flutter's Row, with optional gap between them. The row will start at the startX and startY position. The width and height of the row can be specified, but at least one of them must be greater than 0. The axisAlign parameter controls how the items are aligned along the horizontal axis, while the crossAlign parameter controls how they are aligned along the vertical axis. If mask is set to true, the parent container of the items will be clipped to the specified width and height. If debug is set to true, a red rectangle will be drawn around the row for debugging purposes. Make sure all items belongs to the same parent.
wrap(List<GDisplayObject> items, {double gapX = 0, double gapY = 0, double width = 0, double height = 0, double startX = 0, double startY = 0}) → void
Wraps a list of display objects either horizontally or vertically, depending on whether width or height is defined.