of static method

FloatingActionButtonLocation of(
  1. BuildContext context, {
  2. required double contentAreaWidth,
  3. FloatingActionButtonLocation narrowFallback = FloatingActionButtonLocation.endFloat,
})

Resolve a location from the scaffold's content-area width.

Pass the same contentAreaWidth used for SafaehContentAlignedAppBar.forContentArea / SafaehContentBand (typically LayoutBuilder max width).

Implementation

static FloatingActionButtonLocation of(
  BuildContext context, {
  required double contentAreaWidth,
  FloatingActionButtonLocation narrowFallback =
      FloatingActionButtonLocation.endFloat,
}) {
  if (!SafaehTheme.of(context).isWide(context)) {
    return narrowFallback;
  }
  final metrics = safaehRailAwareBandMetrics(context, contentAreaWidth);
  return resolve(
    leftOffset: metrics.leftOffset,
    bandWidth: metrics.bandWidth,
    endFree: metrics.endFree,
    textDirection: Directionality.of(context),
    narrowFallback: narrowFallback,
  );
}