intrinsic_dimension
0.3.1, released 4 years ago by netwriper.com
A widget that provides dimensions and offset of a child returned from a builder callback.
WASM-ready
What it does
It measures the width, height, and start offset of a widget rendered inside its builder callback by utilizing render boxes after the first frame. It offers options to rebuild on every frame or listen to dimension updates without rebuilding.
AI-written summary of version 0.3.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to know the dynamic dimensions or offset of a widget to draw dependent UI elements like lines.
- You want to react to size and position changes caused by OS settings.
Skip it when
- Standard layout constraints and flexible widgets can already achieve your layout goals without measuring.
- You require complex multi-pass layout algorithms where simpler layout widgets would suffice.
Strengths
- Provides direct access to width, height, and start offset of rendered child widgets.
- Includes a listener option to perform actions based on dimensions without interfering with rebuilds.
- Supports rebuilding on every frame for tracking dynamic changes.
Weaknesses
- Relies on measuring after the initial frame, which might introduce layout passes.
- Limited to a single specific measurement use case.
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 0
IntrinsicDimension(
listener: (context, width, height, startOffset) {
print('WIDTH: $width');
},
builder: (context, width, height, startOffset) {
return Text('Measured text');
},
)Alternatives
Packages that do the same job and could replace intrinsic_dimension.
- bubble_box
A customizable bubble-shaped container widget for Flutter.
44Compare