Fit

August 21, 2026 · View on GitHub

Strategy module: appdimens_fit · part of the AppDimens Flutter family

What it is

Uses the smaller of the two axis ratios, guaranteeing the element always fits inside its target area.

Calculation used

$\text{text} \text{out} = \text{b} \times \text{min}(\text{s\_min}/300, \text{s\_max}/533) $

The default path reuses the memoized factor after the min() is resolved per snapshot.

How to use

import 'package:appdimens_fit/appdimens_fit.dart';
final size = 16.ftsdp;   // contain-style sizing

Why use it

Mirrors BoxFit.contain semantics for dimensioning: never overflow, accept letterboxing.

When to use it

Logos, badges, illustrations and dialogs that must remain fully visible.

Advantages & trade-offs

✅ Advantages⚠️ Trade-offs
No overflow · safe by construction
------

Use Fit for anything that must never clip; combine with AutoResizeText for text.


AppDimens Flutter 3.2.0 — see MATHEMATICS-AND-CALCULUS.md for the formal derivation.