AppDimens Flutter

August 22, 2026 · View on GitHub

Responsive dimensions for Android · iOS · Web · Windows · macOS · Linux — modular strategy library with fast-lane resolution

Version 3.2.0   License Apache 2.0   Flutter   Dart   14 scaling modes

Beginner guide    Full documentation    Performance report    Migration guide


Write values like 16.sdp and the library scales them from the live window snapshot (size, density, font scale) — on every platform Flutter runs on, with the same math, the same API grammar and the same performance architecture as AppDimens Dynamic and AppDimens KMP.

This is a faithful Flutter port of the AppDimens family: same formulas (bit-parity constants), same suffix grammar (sdp, sdpa, sdpPh…), same facilitators, builders, inverters, cache design and fast lane.


✨ Highlights (3.2.0)

🧮 14 scaling modesScaled (default), Percent, Power, Fluid, Auto, Logarithmic, Interpolated, Diagonal, Perimeter, Fill, Fit, Density + Resize fitting + physical units
Fast lane16.sdp = one static snapshot read + one multiply (~6.6–8.7 ns on a modern JIT — every audited stem sits on the harness noise floor; the Kotlin engine measures 6–30 ns on device)
🪟 Per-window snapshotsImmutable DimenMetrics published by AppDimensProvider; rotation, split-screen and font-scale changes self-heal — no stale values
🧊 Snapshot-partitioned cacheMax 4 partitions × 512 entries; dominant families bypass the hash entirely (one multiply beats a lookup)
🔤 One grammar everywhereSuffixes a · i · ia, inverters Ph/Lh/Pw/Lw, facilitators Rotate/Mode/Qualifier/Screen (+ logic-only Plain) on every strategy
🧩 ModularPrincipal artifact appdimens_flutter plus one opt-in package per strategy (appdimens_percent, appdimens_power, …) and an all-in-one appdimens_bom
♾️ MultiplatformAndroid · iOS · Web · Windows · macOS · Linux — pure Dart engine, zero platform channels

🚀 Quick start

Installation

All 15 packages are published on pub.dev. Add the principal artifact with:

flutter pub add appdimens_flutter      # Flutter apps
dart pub add appdimens_flutter         # pure-Dart packages

Optional strategy satellites — install only what you use:

flutter pub add appdimens_percent        # literal % of screen axes (spaceW/spaceH)
flutter pub add appdimens_power          # sub-linear growth for large screens
flutter pub add appdimens_fluid          # clamped band ±20%
flutter pub add appdimens_auto           # phone/tablet knee at 480 dp
flutter pub add appdimens_logarithmic    # strong ±0.4·ln damping
flutter pub add appdimens_interpolated   # fixed 50% blend
flutter pub add appdimens_diagonal       # orientation-stable diagonal ratio
flutter pub add appdimens_perimeter      # half-perimeter ratio
flutter pub add appdimens_density        # dpi/160 physical alignment
flutter pub add appdimens_fill           # cover-like growth
flutter pub add appdimens_fit            # contain-like growth
flutter pub add appdimens_resize         # constraint auto-fit widgets
flutter pub add appdimens_units          # mm/cm/inch helpers

# or everything at once:
flutter pub add appdimens_bom

Equivalent pubspec.yaml:

dependencies:
  appdimens_flutter: ^3.2.0            # principal artifact (core + scaled)
  # optional strategies, exactly like the Kotlin satellite modules:
  appdimens_percent: ^3.2.0
  appdimens_auto: ^3.2.0
  # …or everything at once:
  appdimens_bom: ^3.2.0

Packages on pub.dev

PackagePurpose
appdimens_flutterPrincipal artifact: core engine, cache, Scaled (sdp/hdp/wdp/ssp)
appdimens_bomAll-in-one meta-package (whole family, one version)
appdimens_percent · appdimens_power · appdimens_fluid · appdimens_autoPercent · Power · Fluid · Auto
appdimens_logarithmic · appdimens_interpolated · appdimens_diagonal · appdimens_perimeterLogarithmic · Interpolated · Diagonal · Perimeter
appdimens_density · appdimens_fill · appdimens_fitDensity · Fill · Fit
appdimens_resize · appdimens_unitsConstraint auto-fit · mm/cm/inch units

The principal artifact is appdimens_flutter — the bare name appdimens was blocked by the pub.dev naming-similarity policy (app_dimen).

Wrap your app once

import 'package:appdimens_flutter/appdimens.dart';

void main() => runApp(
      AppDimensApp(                       // publishes the window snapshot
        child: MaterialApp(home: const MyPage()),
      ),
    );

Use it

import 'package:appdimens_flutter/appdimens.dart';

Box(
  width: 100.wdp,
  height: 48.hdp,
).padding(EdgeInsets.all(16.sdp))
 .child(Text('Hello', fontSize: 16.ssp));

That exact code scales correctly on phones, tablets, foldables, desktop windows and the browser.

ExtensionBased onTypical use
sdpSmallest window widthPadding, margins
hdpWindow heightRow height
wdpWindow widthColumn width
sspSame idea as sdp, for textfontSize
semSame, ignoring the system font scalefontSize

Suffixes

SuffixMeaning
(none)Default curve
aAspect-ratio aware curve
iIgnore multi-window heuristic (returns the raw base inside split-screen)
iaBoth
16.sdpa       // + aspect ratio
32.hdpi       // height axis + ignore multi-window
16.sspa       // scalable sp + aspect ratio

Orientation inverters

32.sdpPh   // SW-based; in portrait uses height
32.sdpLw   // SW-based; in landscape uses width
50.hdpLw   // Height-based; in landscape uses width
50.wdpLh   // Width-based; in landscape uses height

Facilitators

80.sdpRotate(50)                                   // landscape → 50 scaled instead
30.sdpMode(200, UiModeType.television)             // TV → 200 scaled
60.sdpQualifier(120, DpQualifier.smallWidth, 600)  // sw ≥ 600 → 120 scaled
16.sdpRotatePlain(24)                              // logic-only pick (no double scaling)

Builder chain

final pad = 100.scaledDp
    .screen(UiModeType.television, DpQualifier.smallWidth, 600, 250)
    .screenMode(UiModeType.television, 500)
    .screenQualifier(DpQualifier.smallWidth, 600, 150)
    .screenOrientation(OrientationRequest.landscape, 120);
// resolved.sdp → scaled value under the current window

Auto-resize widgets

AutoResizeText('Headline that must fit', minSp: 10, maxSp: 28),
AutoResizeSquare(min: 40, max: 120, child: Icon(Icons.aspect_ratio)),

Explicit context (no provider needed)

final pad = 16.sdpOf(context);          // any AppDimensContext
final px  = AppDimens.getDimensionInPx(context, DpQualifier.smallWidth, 16);

📦 Modules

PackageContents
appdimens_fluttercommon, core (engine/cache/metrics), scaled families, provider
appdimens_percentappdimens_unitsOne package per strategy — mirrors appdimens-kmp-* / appdimens-dynamic-*
appdimens_bomMeta-package re-exporting everything at a coherent version
apps/sampleConverted sample app (strategy routing demo + benchmark dashboard)
apps/benchlabBenchLab competitor benchmark (A/B methodology, parity tables, reports)

Full graph and dependency rules: DOCUMENTATION/MODULES.md.


📚 Documentation

ResourceUse for
DOCUMENTATION/README.mdPer-strategy explanations (14 guides)
DOCUMENTATION/API-CONVENTIONS.mdEvery extension property & facilitator catalog
DOCUMENTATION/MATHEMATICS-AND-CALCULUS.mdFormal math, constants, precision policy
DOCUMENTATION/MODULES.mdPackage graph
GUIDE-FOR-BEGINNERS.mdPlain-language walkthrough
PERFORMANCE.md / PERFORMANCE-COMPARATIVE.mdMeasured numbers and competitor comparison
MIGRATION.mdReplacing the deprecated 2.x Flutter API
LLMS.txt · skills/AI-agent resources (LLM index + agent workflow skill)

Recommendation order for most apps: Scaled (with or without a) → then percent → then auto; explore the rest when you have a clear need (fluid, fit, diagonal…).


🖥️ Example apps

  • apps/sample — every section of the demo (core extensions, inverters, facilitators, builder chains, auto-resize) plus a benchmark dashboard.
  • apps/benchlab — the BenchLab pipeline (UI probe, isolate engine probe, legacy T1/T2/T3 passes, resolution-parity tables, report export).
flutter run --device <id> -t lib/main.dart   # inside apps/sample or apps/benchlab

🤝 Contributing & community


Apache License 2.0 — responsive layout utilities for Flutter (Android · iOS · Web · Windows · macOS · Linux). Part of the AppDimens family: Android/Dynamic · KMP · Flutter.