File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change 11import 'package:flutter/animation.dart' ;
22import 'package:flutter/rendering.dart' ;
3+ import 'package:flutter/scheduler.dart' ;
34import 'package:local_hero/src/rendering/controller.dart' ;
45import 'package:local_hero/src/rendering/layer.dart' ;
56
@@ -144,6 +145,16 @@ class RenderLocalHeroFollowerLayer extends RenderProxyBox {
144145 : constraints.enforce (BoxConstraints .tight (requestedSize));
145146 child! .layout (childConstraints, parentUsesSize: true );
146147 size = constraints.constrain (child! .size);
148+
149+ if (requestedSize == null ) {
150+ // The size is not known yet, let's wait for the next frame.
151+ // This happens e.g. when the widget is animated (e.g. flutter_animate).
152+ // Removing "workaround" will result in a flickering effect where the
153+ // first frame of the animation takes the full size of the LocalHeroScope.
154+ SchedulerBinding .instance.addPostFrameCallback ((_) {
155+ markNeedsLayout ();
156+ });
157+ }
147158 }
148159
149160 @override
You can’t perform that action at this time.
0 commit comments