responsive_reflow 1.1.0 copy "responsive_reflow: ^1.1.0" to clipboard
responsive_reflow: ^1.1.0 copied to clipboard

Responsive & adaptive Flutter layout utilities — Material 3 window size-class breakpoints, spacing tokens, adaptive navigation scaffold, responsive builders, and foldable-aware helpers. Reflows by wid [...]

responsive_reflow #

Responsive & adaptive layout utilities for Flutter.

Pub Version Pub Points GitHub License GitHub Repo melos

Provides Material 3 window size-class breakpoints, spacing tokens, responsive builders, an adaptive navigation scaffold, input-density helpers, foldable awareness, and safe-area utilities — all built on official Flutter guidance. It reflows layouts by available width; it never pixel-scales like flutter_screenutil or responsive_framework's AutoScale.

Why reflow, not scale #

  • Width drives layout, never device type. Decisions branch on the window width (and capabilities), so the same screen adapts on phones, foldables, tablets, desktop, and split-screen.
  • No flutter_screenutil (.w/.h) and no AutoScale. Scaling fakes responsiveness and breaks text scaling/accessibility. Use real constraints, Flexible/Expanded, Wrap, and LayoutBuilder.

Material 3 breakpoints #

Window size class Width (logical px) RrBreakpoint Typical navigation
Compact < 600 RrBreakpoint.compact Bottom navigation bar
Medium 600 – 839 RrBreakpoint.medium Navigation rail (icons)
Expanded 840 – 1199 RrBreakpoint.expanded Full sidebar
Large 1200 – 1599 RrBreakpoint.large Full sidebar
Extra large ≥ 1600 RrBreakpoint.extraLarge Full sidebar

Thresholds are configurable — see Configurable breakpoints.

Features #

  • BreakpointsRrBreakpoint enum with comparison operators (>=, >, <=, <) and helpers (isCompact, isExpanded, showsSidebar, isMobileLayout, isDesktopLayout).
  • Configurable thresholdsRrBreakpoints (immutable config) + RrBreakpointsTheme (inherited override for a subtree).
  • Spacing tokensRrSpacing, RrEdgeInsets, RrGap, RrRadius.
  • Responsive buildersRrResponsiveBuilder (window) and RrConstraintResponsiveBuilder (parent constraints), both with smaller-to-larger cascade fallback.
  • Responsive values & widgetsRrResponsiveValue<T>, RrResponsiveVisibility, RrResponsiveRowColumn.
  • Adaptive scaffoldRrAdaptiveScaffold auto-switches bottom nav → rail → sidebar, with FAB, optional desktop app bar, and animated transitions.
  • Constrained contentConstrainedContent, RrPageContent (max-width + responsive padding + safe area + scroll-position restoration).
  • Responsive gridRrResponsiveGrid and RrResponsiveGrid.builder (lazy) with width-derived column counts.
  • Input densityRrDensity / RrPointerModeDetector for touch-vs-pointer VisualDensity.
  • Policy & capabilitiesRrPolicy (size-based decisions) and RrCapability (hardware/runtime facts).
  • Foldable awarenessRrDisplayFeatures (hinge/fold detection).
  • Safe area & insetsRrSafeArea, RrInsets.

Usage #

import 'package:responsive_reflow/responsive_reflow.dart';

Responsive builder #

RrResponsiveBuilder(
  compact: (context) => MobileLayout(),
  expanded: (context) => DesktopLayout(),
)

Responsive value #

final columns = const RrResponsiveValue<int>(
  compact: 1,
  medium: 2,
  expanded: 3,
).resolve(context);

Responsive visibility & row/column #

RrResponsiveVisibility(
  visibleFrom: RrBreakpoint.expanded,
  child: SecondaryPanel(),
)

RrResponsiveRowColumn(
  rowFrom: RrBreakpoint.medium,
  spacing: RrSpacing.lg,
  children: [LabelField(), ValueField()],
)

Spacing tokens #

Padding(padding: RrEdgeInsets.allLg, child: content)
Column(children: [widget1, RrGap.verticalSm, widget2])

Adaptive scaffold #

RrAdaptiveScaffold(
  destinations: const [
    RrDestination(icon: Icons.home, label: 'Home'),
    RrDestination(icon: Icons.calendar_month, label: 'Schedule'),
  ],
  currentIndex: navigationShell.currentIndex,
  onDestinationSelected: navigationShell.goBranch,
  body: navigationShell,
  floatingActionButton: const FloatingActionButton(...),
)

Page content #

RrPageContent(
  maxWidth: 1000,
  child: Column(children: [...]),
)

Responsive grid (lazy) #

RrResponsiveGrid.builder(
  maxItemWidth: 300,
  itemCount: items.length,
  itemBuilder: (context, i) => ItemCard(items[i]),
)

Input density #

Theme(
  data: Theme.of(context).copyWith(visualDensity: RrDensity.density),
  child: child,
)

Configurable breakpoints #

RrBreakpointsTheme(
  breakpoints: const RrBreakpoints(medium: 560, expanded: 900),
  child: app,
)

References #

License #

MIT — see LICENSE.

7
likes
0
points
204
downloads

Publisher

verified publisherdartcoder.in

Weekly Downloads

Responsive & adaptive Flutter layout utilities — Material 3 window size-class breakpoints, spacing tokens, adaptive navigation scaffold, responsive builders, and foldable-aware helpers. Reflows by width; never pixel-scales.

Repository (GitHub)
View/report issues

Topics

#responsive #adaptive #layout #breakpoints #ui

License

unknown (license)

Dependencies

flutter

More

Packages that depend on responsive_reflow