measure_size 1.0.0+1
measure_size: ^1.0.0+1

Flutter Android iOS web

A widget that provides a callback

measure_size #

A stateful widget that measures the size of a child widget immediately after it is rendered.

CAUTION: Does not work with PreferredSizeWidget

Measuring text and drawing an overlay with matching size
import 'package:measure_size/measure_size.dart';

MeasureSize(
    onChange: (Size newSize) {
        /// [newSize] will be the displayed size of [Widget child]
    },
    child: Text('Lorem ipsum dolor sit amet'),
);

MeasureSize #

Required

  • Widget child - This widget will be displayed and and measured.

Optional

  • void onChange(Size newSize) - A callback that is fired exactly once after the first frame of the child widget is rendered.

Example #

A quick demonstration can be found in the example directory. To run the example:

flutter run example/main.dart

Credits #

Thanks to Gene Bo and Dev Aggarwal for this code in a stackoverflow answer: https://stackoverflow.com/a/60868972

1
likes
100
pub points
59%
popularity

A widget that provides a callback

Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

matt@workpail.com

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on measure_size