Skip to content
pubscout

measured_size

1.0.0, released 6 years ago by an unverified publisher

A Flutter widget that calculates the size of its child at runtime.

WASM-ready
$ flutter pub add measured_size
Source repository

What it does

MeasuredSize wraps a child widget and provides an onChange callback that triggers whenever the child's size changes. It ensures the callback is only executed when the size actually changes and ignores zero sizes.

AI-written summary of version 1.0.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to dynamically adjust layout based on the rendered size of a child widget.
  • You want to react to runtime size changes of specific widgets.

Skip it when

  • You can accomplish the same layout using standard constraints like LayoutBuilder.
  • You do not need to read the size of the child programmatically.

Strengths

  • Simple and straightforward API.
  • Prevents duplicate size change notifications by filtering out identical sizes and Size.zero.

Weaknesses

  • Limited documentation and features beyond basic size observation.
  • Older package version with no recent updates.

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
0

none

MeasuredSize(
              onChange: (Size size) {
                setState(() {
                  print(size);
                });
              },
              child: Text(
                '$_counter',
                style: Theme.of(context).textTheme.headline4,
              ),
            );

Alternatives

Packages that do the same job and could replace measured_size.

  • glassmorphism

    Create glassmorphic frosted glass containers with backdrop blur and gradient borders.

  • zoom_widget

    A Flutter widget to create a customizable canvas with zoom and scroll capabilities.

  • widget_size

    A single-purpose widget to calculate its size after being built and attached to the tree.