HexGridBuilder class
六边形网格构建器帮助类 简化网格的创建和 widget 的自动布局
Constructors
-
HexGridBuilder({required HexGridConfig config, List<
Widget> children = const [], HexLayoutStrategy? layoutStrategy}) -
HexGridBuilder.defaultGrid({required Size containerSize, int columns = 4, int rows = 4, HexOrientation orientation = HexOrientation.flat, List<
Widget> children = const [], HexLayoutStrategy? layoutStrategy}) -
使用默认配置创建构建器
factory
Properties
-
children
→ List<
Widget> -
final
- config → HexGridConfig
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- layoutStrategy → HexLayoutStrategy?
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
build(
{dynamic onCellTap(HexCoordinate)?, dynamic onCellLongPress(HexCoordinate)?, dynamic onCellHover(HexCoordinate?)?}) → HexagonalGrid - 构建网格并自动分配 widgets
-
buildWithManualLayout(
{required List< HexWidget> widgets, dynamic onCellTap(HexCoordinate)?, dynamic onCellLongPress(HexCoordinate)?, dynamic onCellHover(HexCoordinate?)?}) → HexagonalGrid - 手动指定 widgets 的位置和尺寸
-
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 Methods
-
emptyGrid(
{required Size containerSize, int columns = 4, int rows = 4, HexOrientation orientation = HexOrientation.flat, bool showGridLines = true, Color gridLineColor = Colors.grey, dynamic onCellTap(HexCoordinate)?, dynamic onCellLongPress(HexCoordinate)?, dynamic onCellHover(HexCoordinate?)?}) → HexagonalGrid - 创建一个简单的空网格