Search packages, repositories and app categories

Package detailsv1.0.0

widget_size

A widget to calculate it's size after being built and attached to a widget tree

AndroidiOSWebmacOSWindowsLinux
30-day downloads
2.3K
Likes
38
Pub points
150

Install package

flutter pub add widget_size

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

The widget_size package provides a widget that calculates its own size after being built and attached to the widget tree. It enables developers to access the actual rendered dimensions of a widget during runtime, which is useful for dynamic layout adjustments, responsive design, or measuring content size without relying on static values. The package works across all major platforms including Android, iOS, Web, macOS, Windows, and Linux, making it ideal for cross-platform applications. It integrates seamlessly with Flutter’s build system and requires minimal setup.

Use cases

  • Dynamic layout sizing
  • Responsive UI measurements
  • Content dimension tracking
  • Cross-platform size detection
  • Runtime widget analysis

Key features

  • Real-time size calculation
  • Cross-platform compatibility
  • Minimal configuration
  • Integration with build context
  • Supports all Flutter platforms

Suitable for

  • Developers needing precise widget dimensions
  • Apps with adaptive layouts
  • UI testing and debugging
  • Cross-platform projects
  • Performance-sensitive designs

Considerations

  • May impact performance if overused
  • Requires attachment to widget tree
  • Not suitable for pre-build size estimation
  • Limited to post-build measurements
  • Best used sparingly in complex trees

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

widget_size

pub package

A widget to calculate it's size after being built and attached to a widget tree

Usage

To use this plugin, add widget_size as a dependency in your pubspec.yaml file.

dependencies:
  widget_size: ^lastVersion

Example

double _yourHeight = 50;
double _yourWidth = 50;

WidgetSize(
  onChange: (Size size) {
    // your Widget size available here
    _yourHeight = size.height;
    _yourWidth = size.width;
  },
  child: Container(
    height: _yourHeight,
    width: _yourWidth,
    color: Theme.of(context).primaryColor,
  ),
)

Categories

Source repository

Projects using this package

No data available yet.