prototype_constrained_box 1.0.0 copy "prototype_constrained_box: ^1.0.0" to clipboard
prototype_constrained_box: ^1.0.0 copied to clipboard

A ConstrainedBox-like widget, but the constraints are given by another widget.

prototype_constrained_box #

Version License

Features #

  • Just like ConstrainedBox, you can constrain the child of this widget;
  • However, instead of passing directly a BoxConstraints, you pass another prototype widget that will be used as constraint;
  • You may constrain the child loosely or tightly, in one or both of the axes.

Getting started #

Add prototype_constrained_box as a dependency in your pubspec.yaml:

dependencies:
   prototype_constrained_box: ^0.0.1

Usage #

Use the PrototypeConstrainedBox widget by providing a prototype and a child.

The following example will render a ColoredBox that will fill the space that the given prototype text would occupy:

const PrototypeConstrainedBox.tight(
  prototype: Text('Lorem ipsum dolor'),
  child: ColoredBox(color: Color(0xFFFF0000)),
);

For more information regarding the PrototypeConstrainedBox API, refer to the documentation.

6
likes
150
pub points
73%
popularity

Publisher

verified publishermateusfccp.me

A ConstrainedBox-like widget, but the constraints are given by another widget.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on prototype_constrained_box