flexi_ui 1.2.1
flexi_ui: ^1.2.1 copied to clipboard
A high-performance Flutter responsive UI framework with type-safe breakpoints, fluid scaling, and component-level adaptive layouts.
Flexi UI ๐ #
A High-Performance, Type-Safe Flutter Responsive & Adaptive UI Framework
Flexi UI is a production-ready Flutter responsive framework for building scalable, adaptive apps across mobile, tablet, and desktop.
It combines fluid scaling, breakpoint-based layouts, design tokens, and a granular performance model powered by InheritedModel.
โจ Why Flexi UI? #
Most responsive solutions only scale sizes. Flexi UI provides a complete adaptive system:
โ Screen-based scaling
โ Parent-based component scaling
โ Discrete breakpoint logic
โ Fluid multi-stage interpolation
โ Responsive design tokens (spacing, typography, icons)
โ Built-in accessibility & motion helpers
โ Granular rebuild performance
๐ Table of Contents #
- Getting Started
- API Quick Reference
- Scaling System
- Component-Level Responsiveness
- Layout & Adaptive Components
- Design Tokens
- Motion & Accessibility
- Breakpoints & Device Model
- Configuration
- Best Practices
- Performance Model
- Troubleshooting
- Debug Overlay
- Example App
- Support
๐ Getting Started #
1๏ธโฃ Install #
dependencies:
flexi_ui: ^1.2.1
2๏ธโฃ Wrap Your App #
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return FlexiConfig(
designMinWidth: 360,
designMaxWidth: 1440,
showDebugOverlay: true,
child: const MaterialApp(home: DashboardScreen()),
);
}
}
3๏ธโฃ Use Anywhere #
@override
Widget build(BuildContext context) {
final flexi = context.flexi;
return Scaffold(
appBar: AppBar(title: Text(flexi.breakpoint.name)),
body: flexi.isDesktop ? DesktopLayout() : MobileLayout(),
);
}
๐งพ API Quick Reference #
Extensions on num #
.w(context)โ % of screen width.h(context)โ % of screen height.rw(context)โ responsive width.rh(context)โ responsive height.fw(context)โ parent-based width.fh(context)โ parent-based height.aw(max, context)โ fluid width interpolation.ah(max, context)โ fluid height interpolation.fr(context)โ fluid radius scaling.fStroke(context)โ dampened border scaling.fs(context)โ safe uniform scalingTuple2(a, b).d(context)โ diagonal scaling
Helpers #
FlexiFluid3โ tiered fluid scalingBreakpointValue<T>โ discrete breakpoint valuescontext.flexiโ semantic responsive helper
๐ Scaling System #
๐ฅ Screen-Based Scaling #
| Method | Description |
|---|---|
.rw(context) |
Responsive width (design โ screen) |
.rh(context) |
Responsive height |
.w(context) |
% of screen width |
.h(context) |
% of screen height |
๐ Fluid Interpolation #
fontSize: 18.aw(32, context)
๐ Tiered Scaling #
const FlexiFluid3(mobile: 14, tablet: 16, desktop: 20).resolve(context);
๐ Visual Scaling #
| Method | Purpose |
|---|---|
.fr(context) |
Fluid radius scaling |
.fStroke(context) |
Fluid border width |
.fs(context) |
Safe uniform scaling |
๐งฑ Component-Level Responsiveness #
ResponsiveCard(
targetWidth: 300,
targetHeight: 400,
child: Padding(
padding: EdgeInsets.all(16.fw(context)),
),
)
FlexiCircle #
FlexiCircle(size: 48, child: Icon(Icons.person))
๐งฉ Layout & Adaptive Components #
- FlexiLayout โ breakpoint-based layouts
- FlexiAdaptiveNav โ adaptive navigation
- FlexiGrid โ responsive grid
- FlexiMaxWidth โ max-width constraint
- FlexiVisibility โ breakpoint visibility
๐จ Design Tokens #
Typography #
FlexiTextStyles.h1(context)
Spacing #
FlexiSpacing.m(context)
Icons #
FlexiIconSize.m(context)
๐ Motion & Accessibility #
Motion #
FlexiMotion.durationMedium(context)
Accessibility #
FlexiMinTapTargetFlexiTextClamp
๐ Breakpoints #
| Breakpoint | Meaning |
|---|---|
| mobilePortrait | Phone portrait |
| mobileLandscape | Phone landscape |
| tablet | Tablet layouts |
| desktop | Desktop layouts |
โ Configuration #
FlexiConfig(
designMinWidth: 360,
designMaxWidth: 1440,
mobilePortraitBreakpoint: 600,
tabletLandscapeBreakpoint: 1100,
spacing: FlexiSpacingConfig.defaultConfig,
typography: FlexiTypographyConfig.defaultConfig,
icons: FlexiIconConfig.defaultConfig,
)
Advanced Flags #
| Flag | Purpose |
|---|---|
useParentConstraints |
Use parent layout instead of MediaQuery |
allowImplicitRebuilds |
Allow rebuilds without aspect (not recommended) |
โ Best Practices #
- Use
context.flexi.breakpointfor layout switching - Prefer design tokens over hardcoded sizes
- Use
.fs()for circles/icons - Keep
allowImplicitRebuildsdisabled
โก Performance Model #
Flexi UI uses InheritedModel aspect scoping for minimal rebuilds.
You get performance benefits automatically.
โ Troubleshooting #
FlexiConfig not found โ Wrap your app root with FlexiConfig.
Circles distorted โ Use .fs(context).
Unbounded constraints โ Use FlexiMaxWidth or constrained parent.
๐ Debug Overlay #
FlexiConfig(showDebugOverlay: true)
Shows screen metrics & breakpoints in debug mode.
๐ฑ Example App #
See /example for dashboard, grids, forms, and scaling showcase.
๐ค Support & Contributions #
- Issues: https://github.com/akshaySavanoor/flutter_flexi/issues
- PRs welcome
Made with โค๏ธ for the Flutter community