boxy 2.0.4
boxy: ^2.0.4 copied to clipboard

Layout made simple. Overcomes many limitations by the framework regarding layout

boxy, Layout made simple

About #

Boxy is designed to overcome the limitations of Flutter's built-in layout widgets, it provides utilities for flex, custom multi-child layouts, dynamic widget inflation, slivers, and more!

Flex layouts #

A common design problem is when you need one or more children of a Row or Column to have the same cross-axis size as another child in the list, with boxy this can be achieved trivially using BoxyRow, BoxyColumn and Dominant.

Using BoxyRow. A sidebar matches the height of a dynamically sized container

Using BoxyColumn. An underbar matches the width of a dynamically sized container

Using BoxyColumn and BoxyFlexible.align; The top child has a custom cross axis alignment from the others

See the documentation of BoxyRow and BoxyColumn for more information.

Custom layouts #

One of the pains of implementing custom layouts is learning the RenderObject model and how verbose it is, to make this process easier we provide an extremely simple container CustomBoxy that delegates layout, paint, and hit testing.

1. Declare widget using CustomBoxy 2. Implement delegate. Dynamic header and content in a column with an avatar pinned to the center of both

The most powerful feature of CustomBoxy is the ability to inflate arbitrary widgets at layout time, this means widgets can depend on the size of others, something previously impossible without hacky workarounds.

Lazy-loading children with BoxyDelegate.inflate to match the width of a container

See the documentation of CustomBoxy and BoxyDelegate for more information.

Slivers #

Ever want to give SliverList a box decoration? The sliver library provides SliverContainer which allows you to use box widgets as the foreground or background of a sliver.

This library also provides SliverCard, a SliverContainer that looks like a card.

Adding a custom card-like background to a SliverList, while still building lazily

Also check out:

Miscellaneous #

The utils library provides extensions with dozens of axis-dependant methods on BoxConstraints, Size, Offset, and more. These extensions make writing directional layouts significantly less cumbersome.

The OverflowPadding widget is similar to Padding but allows the child to overflow when given negative insets.

164
likes
120
pub points
83%
popularity

Publisher

tst.sh

Layout made simple. Overcomes many limitations by the framework regarding layout

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

flutter, vector_math

More

Packages that depend on boxy