scaledForContext method

FlutterFolderViewTheme<T> scaledForContext(
  1. BuildContext context,
  2. double factor
)

Convenience for the dominant call site: extracts the ambient defaultFontSize from Theme.of(context).textTheme.bodyMedium and delegates to scale.

Couples this entry point to the Material text theme. The per-Theme scale methods remain framework-agnostic and can be tested in pure Dart without a widget tree.

Identity: scaledForContext(context, 1.0) returns this.

Implementation

FlutterFolderViewTheme<T> scaledForContext(
  BuildContext context,
  double factor,
) {
  if (factor == 1.0) return this;
  final defaultFontSize =
      Theme.of(context).textTheme.bodyMedium?.fontSize ?? 14.0;
  return scale(factor: factor, defaultFontSize: defaultFontSize);
}