Overview
The measure_size package is a Flutter widget that triggers a callback whenever its size changes, enabling dynamic layout adjustments based on actual rendered dimensions. It wraps a child widget and monitors its size during the build and layout phases, making it ideal for responsive designs or animations that depend on precise measurements. The package works across all major platforms including Android, iOS, Web, macOS, Windows, and Linux, ensuring consistent behavior. It's particularly useful when you need to react to changes in container size without relying on fixed values.
Use cases
- Responsive UI with dynamic sizing
- Animations based on widget dimensions
- Layout debugging
- Dynamic content rendering
- Real-time size monitoring
Key features
- Triggers callback on size change
- Cross-platform compatibility
- Simple integration with existing widgets
- Supports all Flutter platforms
- No external dependencies
Suitable for
- Developers needing real-time size feedback
- UI components requiring adaptive layouts
- Testing and debugging layout issues
- Projects with dynamic or fluid design systems
Considerations
- May impact performance if overused
- Callback may fire multiple times during layout
- Not suitable for static size requirements
- Requires careful handling in complex widget trees
- Limited to size changes, not position or offset
