getOffsetY method Null safety
- ScaffoldPrelayoutGeometry scaffoldGeometry,
- double adjustment
override
Calculates y-offset for FloatingActionButtonLocations floating over the transition between the Scaffold.appBar and the Scaffold.body.
Implementation
@override
double getOffsetY(ScaffoldPrelayoutGeometry scaffoldGeometry, double adjustment) {
if (scaffoldGeometry.contentTop > scaffoldGeometry.minViewPadding.top) {
final double fabHalfHeight = scaffoldGeometry.floatingActionButtonSize.height / 2.0;
return scaffoldGeometry.contentTop - fabHalfHeight;
}
// Otherwise, ensure we are placed within the bounds of a safe area.
return scaffoldGeometry.minViewPadding.top;
}