LayoutBuilder: skip calling builder when constraints are the same (#55414)

Avoid calling `builder` in `ConstrainedLayoutBuilder` when layout constraints are the same.

[Design doc](flutter.dev/go/layout-builder-optimization).

## Related Issues

Fixes https://github.com/flutter/flutter/issues/6469
This commit is contained in:
Yegor
2020-05-08 12:27:59 -07:00
committed by GitHub
parent f865ac7e25
commit 324fdb6b3c
4 changed files with 177 additions and 8 deletions

View File

@@ -215,6 +215,14 @@ class _BackdropState extends State<Backdrop> with SingleTickerProviderStateMixin
value: 1.0,
vsync: this,
);
_controller.addStatusListener((AnimationStatus status) {
setState(() {
// This is intentionally left empty. The state change itself takes
// place inside the AnimationController, so there's nothing to update.
// All we want is for the widget to rebuild and read the new animation
// state from the AnimationController.
});
});
_frontOpacity = _controller.drive(_frontOpacityTween);
}