Play Grid Sizing

Status: implemented

The PlayGrid widget has a somewhat idiosyncratic sizing behavior. This doc will capture some of those behaviors.


PlayGrid has two sizing approaches: fixed or shrinkable. If a grid is fixed, then it won’t change size due to its packing. If it’s shrinkable, then the grid will resize to available space within a specified range. These approaches are set at creation time through the sizing property, which is an enum.

Regardless of which sizing method is used, the size of a widget is not determined by the widgets contained within the grid. Instead, the geometry of the puzzle determines the shape and aspect ratio of the grid. The size is determined by the LayoutConfig for fixed grids, and by the min/max_base_size properties plus the available space for shrinkable grids.


  • There are two ways the Grid widget is updated externally. Either through play_grid_update_state or play_grid_set_layout_config. For fixed size-grids, this will set the size of the widget based on the geometry of the puzzle.

  • On the other hand, for shrinkable grids, this API will update the maximum size for the max_base_size widget.

  • One consequence of that is that we can’t set a custom border size with resizable grids, as the border_size is generated by the base_width.