WallLayout constructor

WallLayout(
  1. {required int layersCount,
  2. required List<Stone> stones,
  3. WallBuilder? wallBuilder,
  4. double stonePadding = DEFAULT_BRICK_PADDING,
  5. ScrollController? scrollController,
  6. bool? primary,
  7. ScrollPhysics? physics,
  8. String? restorationId,
  9. Clip clipBehavior = Clip.hardEdge,
  10. DragStartBehavior dragStartBehavior = DragStartBehavior.start,
  11. Axis scrollDirection = Axis.vertical,
  12. 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)");
  });
}