getOffsetX method

  1. @override
double getOffsetX(
  1. ScaffoldPrelayoutGeometry scaffoldGeometry,
  2. double adjustment
)
override

Obtains the x-offset to place the FloatingActionButton based on the Scaffold's layout.

Used by getOffset to compute its x-coordinate.

Implementation

@override
double getOffsetX(ScaffoldPrelayoutGeometry scaffoldGeometry, double adjustment) {
  assert(scaffoldGeometry.textDirection != null);
  switch (scaffoldGeometry.textDirection) {
    case TextDirection.rtl:
      return scaffoldGeometry.minInsets.left - adjustment;
    case TextDirection.ltr:
      return scaffoldGeometry.scaffoldSize.width -
          scaffoldGeometry.minInsets.right -
          scaffoldGeometry.floatingActionButtonSize.width +
          adjustment;
  }
}