Skip to content

Proposal: take advantage of relayout parameter in _ScaffoldLayout class constructor #182330

Description

@nate-thegrate

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.

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work listc: proposalA detailed proposal for a change to Flutterf: material designflutter/packages/flutter/material repository.frameworkflutter/packages/flutter repository. See also f: labels.team-frameworkOwned by Framework teamtriaged-frameworkTriaged by Framework team

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions