The Scaffold widget's build method creates an AnimatedBuilder so that the CustomMultiChildLayout widget is rebuilt every frame the FAB animation sends a notification.
|
child: AnimatedBuilder( |
|
animation: _floatingActionButtonMoveController, |
|
builder: (BuildContext context, Widget? child) { |
|
return Actions( |
|
actions: <Type, Action<Intent>>{DismissIntent: _DismissDrawerAction(context)}, |
|
child: CustomMultiChildLayout( |
|
delegate: _ScaffoldLayout( |
|
extendBody: widget.extendBody, |
|
extendBodyBehindAppBar: widget.extendBodyBehindAppBar, |
|
minInsets: minInsets, |
|
minViewPadding: minViewPadding, |
|
currentFloatingActionButtonLocation: _floatingActionButtonLocation!, |
|
floatingActionButtonMoveAnimationProgress: |
|
_floatingActionButtonMoveController.value, |
|
floatingActionButtonMotionAnimator: _floatingActionButtonAnimator, |
|
geometryNotifier: _geometryNotifier, |
|
previousFloatingActionButtonLocation: _previousFloatingActionButtonLocation!, |
|
textDirection: textDirection, |
|
isSnackBarFloating: isSnackBarFloating, |
|
extendBodyBehindMaterialBanner: extendBodyBehindMaterialBanner, |
|
snackBarWidth: snackBarWidth, |
|
), |
|
children: children, |
|
), |
|
); |
|
}, |
|
), |
I believe we can factor out the AnimatedBuilder by utilizing the MultiChildLayoutDelegate constructor's relayout parameter. This would allow the FAB animation to update the layout directly, rather than triggering a build and a subsequent shouldRelayout call.
The Scaffold widget's build method creates an
AnimatedBuilderso that theCustomMultiChildLayoutwidget is rebuilt every frame the FAB animation sends a notification.flutter/packages/flutter/lib/src/material/scaffold.dart
Lines 3207 to 3233 in 7bafe12
I believe we can factor out the
AnimatedBuilderby utilizing the MultiChildLayoutDelegate constructor'srelayoutparameter. This would allow the FAB animation to update the layout directly, rather than triggering a build and a subsequent shouldRelayout call.