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 optionalgap
between them. The column will start at thestartX
andstartY
position. Thewidth
andheight
of the column can be specified, but at least one of them must be greater than 0. TheaxisAlign
parameter controls how the items are aligned along the vertical axis, while thecrossAlign
parameter controls how they are aligned along the horizontal axis. Ifmask
is set to true, the parent container of the items will be clipped to the specified width andheight
. Ifdebug
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 bycanvasW
andcanvasH
. IfobjW
andobjH
are provided, they should be the original size of the asset. Thefit
parameter works similar to BoxFit in Flutter. Ifreposition
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 optionalgap
between them. The row will start at thestartX
andstartY
position. Thewidth
andheight
of the row can be specified, but at least one of them must be greater than 0. TheaxisAlign
parameter controls how the items are aligned along the horizontal axis, while thecrossAlign
parameter controls how they are aligned along the vertical axis. Ifmask
is set to true, the parent container of the items will be clipped to the specifiedwidth
andheight
. Ifdebug
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
orheight
is defined.