screenx library
screenx — Centralised responsive configuration for Flutter.
Provides adaptive breakpoints, scalable unit conversions, and layout helpers across Android, iOS, and Web from a single entry point.
Quick start
- Wrap your
MaterialAppbuilder:
MaterialApp(
builder: (context, child) => ScreenXLayout(child: child!),
)
- Use the static accessor anywhere:
Text(
'Hello',
style: TextStyle(fontSize: ScreenX.sp(16)),
)
Container(
width: ScreenX.wp(80),
height: ScreenX.dp(48),
)
- Build breakpoint-reactive subtrees:
ScreenXBuilder(
builder: (context, bp) =>
bp.isMobile ? const MobileNav() : const DesktopNav(),
)
Classes
- ScreenBreakpoint
-
A resolved breakpoint descriptor produced by
ScreenXLayoutafter the current screen width has been measured. - ScreenUtil
- Converts design-time values to runtime-appropriate logical pixel values anchored to the current screen dimensions and the device's accessibility settings.
- ScreenX
- Global static accessor for all screenx responsive values.
- ScreenXBuilder
- Rebuilds its subtree when the active ScreenBreakpointTier changes, and only then — not on every pixel of window resize.
- ScreenXData
- An InheritedWidget that carries the current ScreenBreakpoint and ScreenUtil through the widget tree.
- ScreenXLayout
- Initialises screenx and makes responsive values available to the widget tree below it.
Enums
- ScreenBreakpointTier
- The five breakpoint tiers used by screenx.