Skip to content

Configuration

RfsConfig controls the scaling curve.

SettingDefaultPurpose
baseValue20Values at or below this magnitude stay fixed
breakpoint1200Extent at which values reach their maximum
factor10Controls the derived minimum when min is omitted
enabledtrueReturns every maximum unchanged when disabled

Configure one calculation

dart
final value = Rfs.value(
  64,
  width: 600,
  config: const RfsConfig(
    baseValue: 16,
    breakpoint: 1000,
    factor: 8,
  ),
);

Configure a subtree

Wrap a section—or the complete app—in RfsScope:

dart
RfsScope(
  config: const RfsConfig(baseValue: 16, breakpoint: 1000),
  dimension: RfsDimension.shortestSide,
  child: MaterialApp(...),
)

Scope-aware widgets, RfsTypography.of, and context-based resolution inherit these settings. Explicit arguments always win.

Typed values do not have a BuildContext; pass a configuration and dimension explicitly when resolving them directly.

Disable a region

RfsEnabled toggles scaling without replacing the surrounding curve settings:

dart
RfsEnabled(
  enabled: false,
  child: pixelPerfectChart,
)

This is useful for golden tests and for UI regions that must keep fixed values.

Released under the MIT License.