calculateFluidWidth method

double calculateFluidWidth(
  1. LayoutBreakpoint breakpoint,
  2. double layoutWidth
)

Implementation

double calculateFluidWidth(LayoutBreakpoint breakpoint, double layoutWidth) {
  //Distance to next width breakpoint
  final width = breakpoints[breakpoint] ?? layoutWidth;

  final currentDistance = width - layoutWidth;

  final totalDistance = width - breakpoints[breakpoint.smaller]!;

  final totalFluidDistance =
      maxFluidWidth[breakpoint]! - maxFluidWidth[breakpoint.smaller]!;
  final progress = currentDistance / totalDistance;
  final maxFluid =
      maxFluidWidth[breakpoint.bigger]! - totalFluidDistance * progress;
  return maxFluid;
}