WallLayout constructor
WallLayout(
- {required int layersCount,
- required List<
Stone> stones, - WallBuilder? wallBuilder,
- double stonePadding = DEFAULT_BRICK_PADDING,
- ScrollController? scrollController,
- bool? primary,
- ScrollPhysics? physics,
- String? restorationId,
- Clip clipBehavior = Clip.hardEdge,
- DragStartBehavior dragStartBehavior = DragStartBehavior.start,
- Axis scrollDirection = Axis.vertical,
- bool reverse = false}
Implementation
WallLayout(
{required this.layersCount,
required this.stones,
WallBuilder? wallBuilder,
this.stonePadding = DEFAULT_BRICK_PADDING,
this.scrollController,
this.primary,
this.physics,
this.restorationId,
this.clipBehavior = Clip.hardEdge,
this.dragStartBehavior = DragStartBehavior.start,
this.scrollDirection = Axis.vertical,
this.reverse = false})
: _wallBuildHandler = wallBuilder ?? WallBuilder.standard(),
assert(stones.isNotEmpty),
assert(layersCount >= 2,
"You must define layers count from as an integer higher or equal to 2"),
assert(stonePadding >= 0.0),
assert(
!(scrollController != null && primary == true),
'Primary ScrollViews obtain their ScrollController via inheritance from a PrimaryScrollController widget. '
'You cannot both set primary to true and pass an explicit controller.'),
super() {
assert(
this.stones.map((stone) => stone.id).toSet().length ==
this.stones.length,
"Stones identifier must be unique.");
this.stones.forEach((stone) {
final constrainedSide =
this.scrollDirection == Axis.vertical ? stone.width : stone.height;
assert(constrainedSide <= this.layersCount,
"Stone $stone is too big to fit in wall : constrained side ($constrainedSide) is higher than axisDivision ($layersCount)");
});
}