FLUTTER ECOSYSTEM

after_layout

Execute code after the first layout of your widget has been performed, i.e. after the first frame has been displayed.

Latest version
1.2.0
30-day downloads
369K
Likes
777
Pub points
160

Package Overview

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

Overview

The after_layout package enables developers to execute code immediately after a widget's first layout pass, ensuring access to accurate dimensions and positions once the widget has been rendered on screen. It is particularly useful for performing actions that depend on final layout measurements, such as animations, positioning adjustments, or integrating with other UI components. The package works across all major platforms supported by Flutter, including mobile, web, and desktop. It provides a simple API through a mixin that can be added to any StatefulWidget.

Use cases
  • Running post-layout animations
  • Adjusting widget positions based on actual size
  • Initializing third-party libraries requiring layout data
  • Synchronizing UI elements after rendering
  • Handling dynamic content sizing
Key features
  • Simple mixin-based API
  • Cross-platform compatibility
  • Executes once after first frame
  • No need for timers or callbacks
  • Works with StatefulWidgets
Suitable for
  • Developers needing precise layout timing
  • UI-heavy applications with dynamic layouts
  • Animations triggered after rendering
  • Custom widgets requiring layout awareness
Considerations
  • Not suitable for repeated layout events
  • May cause performance issues if misused
  • Requires stateful widget context
  • Limited to one execution per widget instance
  • Does not work before first build
Supported platformsAndroidiOSWebmacOSWindowsLinux

Install package

flutter pub add after_layout

Categories

Source repository

Related projects