flutter_scalify 3.0.0
flutter_scalify: ^3.0.0 copied to clipboard
The Ultimate Responsive Layout System. Features smart scaling, 6-tier grids, adaptive flex layouts, container queries, and 4K protection with zero-allocation math.
Changelog #
All notable changes to this project will be documented in this file.
3.0.0 - 2025-02-16 ๐ (The Performance & Stability Update) #
This is a major release that re-engineers the core scaling engine, introduces powerful developer experience improvements, and brings the following:
- Advanced: Added
observeMetricstoScalifyProviderto prevent race conditions in nested providers (fixes resize lag). - Example: Added comprehensive
ScalifySectiondemo with split-view, nested navigation, and best practices guide. - Tests: Reached 208 passing tests.
โก Core Engine Overhaul #
- InheritedModel with
ScalifyAspect: Replaced global subscription with granular aspects (type,scale,text). Widgets that only need screen type information won't rebuild when scale changes, massively reducing unnecessary rebuilds. - Quantized IDs (Jitter Prevention): Internal float-to-int conversion (ร1000) for
InheritedModelaspect equality checks. Eliminates phantom rebuilds caused by microscopic floating-point differences. - Configurable Rebuild Tolerance:
ResponsiveData.==now usesrebuildScaleThreshold(default 0.01) for scale comparisons andrebuildWidthPxThreshold(default 4.0px) for size comparisons, giving users control over rebuild sensitivity. - Active Debounce:
debounceWindowMillisis now actively implemented viaTimerinScalifyProvider. Platform-driven events (resize, text scale) are debounced while parent-driven updates remain synchronous. - Balanced
scaleFactor: Now usesmath.min(scaleWidth, scaleHeight)to prevent UI overstretching on non-standard aspect ratios. - Modern
textScaler: Replaced deprecatedtextScaleFactorwith Flutter 3.xtextScalerAPI for full Material 3 and accessibility compliance. - ContainerQueryData Tolerance: Added 0.5px sub-pixel tolerance to
ContainerQueryData.==to prevent unnecessary rebuilds from fractional pixel differences.
๐จ Developer Experience (DX) #
- Builder Pattern in
ScalifyProvider: Added optionalbuilderproperty. PlaceScalifyProvideras parent ofMaterialAppto prevent cascading rebuilds on window resize. ScalifySectionWidget: New widget for split-screen/master-detail patterns. Creates an independent scaling context based on the section's actual layout width, not the full screen width. Essential for sidebar + content layouts.ScalifyBuilderDeprecated: Unified builder widgets โ useResponsiveBuilderinstead.ScalifyBuilderremains as a backward-compatible alias.- Context API for
constWidgets: Addedcontext.w(),context.h(),context.r(),context.sp()methods. Ensures responsive values update even insideconstwidget trees. - Percentage Scaling: Added
.pw(% of screen width) and.hp(% of screen height) extensions. - Deprecation Banner Fix: The
_DeprecationBannernow renders inside theMaterialAppcontext when using the builder pattern, fixing the crash caused by missing Material ancestors.
๐ง Component Improvements #
ContainerQueryPerformance: Fully relies onLayoutBuilderinstead of globalMediaQuery. No longer triggers rebuilds from keyboard appearance or system-level changes. Added tolerance threshold to prevent jitter ononChanged.AppWidthLimiterUpgrades: AddedminWidthfor automatic horizontal scrolling on tiny windows. AddedRepaintBoundaryfor 50% performance improvement during window dragging on weak devices.ResponsiveGridCaching: Converted toStatefulWidgetwith cachedSliverGridDelegate, preventing recalculation on every frame during scroll/resize.autoSwapDimensions: New config option that automatically swapsdesignWidth/designHeightin landscape mode.
๐งน Code Quality #
- Removed 90+ lines of dead code, zombie comments, and disabled features.
- Fixed
valueByScreenfallback: Now correctly cascades fromlargeDesktop โ desktop โ tablet โ mobileinstead of skipping tiers. - Assert everywhere: Added debug assertions for negative scales, invalid configs, and missing providers.
๐ Documentation #
- Enhanced
GlobalResponsivedocs: Clarified singleton design, nested provider behavior, and added@visibleForTesting reset()method. - Enhanced
AppWidthLimiterdocs: Documented MediaQuery override behavior, RepaintBoundary rationale, and minWidth scrolling. - Enhanced
ResponsiveHelper.fromContextdocs: Added note about default config behavior. - Enhanced
ResponsiveBuilderdocs: Added usage example and clarified it's the primary builder widget. - Complete README rewrite with comparison tables, full API cheat sheet, all widget examples, ScalifyConfig reference, migration guide, and advanced engine internals.
- Updated CHANGELOG with comprehensive v3.0.0 release notes.
๐งช Test Suite #
- 208 tests passing with optimized test infrastructure.
- Replaced
pumpAndSettle()with targetedpump()for 10ร faster test execution. - Added
pumpApp()helper that correctly handles ScalifyProvider's debounce timer. - All tests use the recommended builder pattern (
ScalifyProvideras parent ofMaterialApp).
2.2.4 - 2025-12-31 ๐ (The Architecture & Logic Update) #
โ ๏ธ Breaking Changes & Rebranding #
- Renamed Provider:
ResponsiveProvideris nowScalifyProvider. This aligns with the package name and avoids conflicts with other libraries. - Renamed Config:
ResponsiveConfigis nowScalifyConfig.
๐จ Theme Integration #
- Added
ScalifyThemeExtension: You can now scale your entire app's text theme in one line usingThemeData.light().scale(context).- Smart Optimization: It automatically checks if the scale factor is
1.0to avoid unnecessary calculations. - Result: No need to add
.fzmanually to every text widget anymore if you use the global theme!
- Smart Optimization: It automatically checks if the scale factor is
๐ง New Logic Widgets #
- Added
ResponsiveVisibility: A powerful widget to conditionally show or hide elements based on screen type.- Supports
visibleOn(Whitelist) andhiddenOn(Blacklist). - Includes assertions to ensure you don't use both lists simultaneously.
- Supports
- Added
ResponsiveLayout: Effortlessly switch betweenportraitandlandscapelayouts using a clean API. - Added
ResponsiveBuilder: A direct way to accessResponsiveDatainside the widget tree via a builder pattern, simplifying complex logic.
๐ Documentation #
- Complete Overhaul: The README has been rewritten to feature a "Why Scalify?" comparison table, better examples, and clearer categorization of features.
2.2.3 - 2025-12-21 ๐ (The Architecture & Logic Update) #
Maintenance: Clean up project structure (removed unused platform folders from root). Improvement: Enhanced project organization. This major update focuses on standardizing the package architecture, improving Developer Experience (DX), and adding powerful logic controls to your UI.
โ ๏ธ Breaking Changes & Rebranding #
- Renamed Provider:
ResponsiveProvideris nowScalifyProvider. This aligns with the package name and avoids conflicts with other libraries. - Renamed Config:
ResponsiveConfigis nowScalifyConfig.
๐จ Theme Integration #
- Added
ScalifyThemeExtension: You can now scale your entire app's text theme in one line usingThemeData.light().scale(context).- Smart Optimization: It automatically checks if the scale factor is
1.0to avoid unnecessary calculations. - Result: No need to add
.fzmanually to every text widget anymore if you use the global theme!
- Smart Optimization: It automatically checks if the scale factor is
๐ง New Logic Widgets #
- Added
ResponsiveVisibility: A powerful widget to conditionally show or hide elements based on screen type.- Supports
visibleOn(Whitelist) andhiddenOn(Blacklist). - Includes assertions to ensure you don't use both lists simultaneously.
- Supports
- Added
ResponsiveLayout: Effortlessly switch betweenportraitandlandscapelayouts using a clean API. - Added
ResponsiveBuilder: A direct way to accessResponsiveDatainside the widget tree via a builder pattern, simplifying complex logic.
๐ Documentation #
- Complete Overhaul: The README has been rewritten to feature a "Why Scalify?" comparison table, better examples, and clearer categorization of features.
2.2.2 - 2025-12-20 ๐ (The Architecture & Logic Update) #
This major update focuses on standardizing the package architecture, improving Developer Experience (DX), and adding powerful logic controls to your UI.
โ ๏ธ Breaking Changes & Rebranding #
- Renamed Provider:
ResponsiveProvideris nowScalifyProvider. This aligns with the package name and avoids conflicts with other libraries. - Renamed Config:
ResponsiveConfigis nowScalifyConfig.
๐จ Theme Integration #
- Added
ScalifyThemeExtension: You can now scale your entire app's text theme in one line usingThemeData.light().scale(context).- Smart Optimization: It automatically checks if the scale factor is
1.0to avoid unnecessary calculations. - Result: No need to add
.fzmanually to every text widget anymore if you use the global theme!
- Smart Optimization: It automatically checks if the scale factor is
๐ง New Logic Widgets #
- Added
ResponsiveVisibility: A powerful widget to conditionally show or hide elements based on screen type.- Supports
visibleOn(Whitelist) andhiddenOn(Blacklist). - Includes assertions to ensure you don't use both lists simultaneously.
- Supports
- Added
ResponsiveLayout: Effortlessly switch betweenportraitandlandscapelayouts using a clean API. - Added
ResponsiveBuilder: A direct way to accessResponsiveDatainside the widget tree via a builder pattern, simplifying complex logic.
๐ Documentation #
- Complete Overhaul: The README has been rewritten to feature a "Why Scalify?" comparison table, better examples, and clearer categorization of features.
2.2.1 - 2025-12-19 ๐ (The Architecture & Logic Update) #
This major update focuses on standardizing the package architecture, improving Developer Experience (DX), and adding powerful logic controls to your UI.
โ ๏ธ Breaking Changes & Rebranding #
- Renamed Provider:
ResponsiveProvideris nowScalifyProvider. This aligns with the package name and avoids conflicts with other libraries. - Renamed Config:
ResponsiveConfigis nowScalifyConfig.
๐จ Theme Integration #
- Added
ScalifyThemeExtension: You can now scale your entire app's text theme in one line usingThemeData.light().scale(context).- Smart Optimization: It automatically checks if the scale factor is
1.0to avoid unnecessary calculations. - Result: No need to add
.fzmanually to every text widget anymore if you use the global theme!
- Smart Optimization: It automatically checks if the scale factor is
๐ง New Logic Widgets #
- Added
ResponsiveVisibility: A powerful widget to conditionally show or hide elements based on screen type.- Supports
visibleOn(Whitelist) andhiddenOn(Blacklist). - Includes assertions to ensure you don't use both lists simultaneously.
- Supports
- Added
ResponsiveLayout: Effortlessly switch betweenportraitandlandscapelayouts using a clean API. - Added
ResponsiveBuilder: A direct way to accessResponsiveDatainside the widget tree via a builder pattern, simplifying complex logic.
๐ Documentation #
- Complete Overhaul: The README has been rewritten to feature a "Why Scalify?" comparison table, better examples, and clearer categorization of features.
2.2.0 - 2025-12-19 ๐ (The Architecture & Logic Update) #
This major update focuses on standardizing the package architecture, improving Developer Experience (DX), and adding powerful logic controls to your UI.
โ ๏ธ Breaking Changes & Rebranding #
- Renamed Provider:
ResponsiveProvideris nowScalifyProvider. This aligns with the package name and avoids conflicts with other libraries. - Renamed Config:
ResponsiveConfigis nowScalifyConfig.
๐จ Theme Integration #
- Added
ScalifyThemeExtension: You can now scale your entire app's text theme in one line usingThemeData.light().scale(context).- Smart Optimization: It automatically checks if the scale factor is
1.0to avoid unnecessary calculations. - Result: No need to add
.fzmanually to every text widget anymore if you use the global theme!
- Smart Optimization: It automatically checks if the scale factor is
๐ง New Logic Widgets #
- Added
ResponsiveVisibility: A powerful widget to conditionally show or hide elements based on screen type.- Supports
visibleOn(Whitelist) andhiddenOn(Blacklist). - Includes assertions to ensure you don't use both lists simultaneously.
- Supports
- Added
ResponsiveLayout: Effortlessly switch betweenportraitandlandscapelayouts using a clean API. - Added
ResponsiveBuilder: A direct way to accessResponsiveDatainside the widget tree via a builder pattern, simplifying complex logic.
๐ Documentation #
- Complete Overhaul: The README has been rewritten to feature a "Why Scalify?" comparison table, better examples, and clearer categorization of features.
2.1.0 - 2025-12-16 ๐ (The Layout & Adaptive System Update) #
This update transforms Scalify from a "Scaling Engine" into a full "Responsive Layout System". It introduces powerful widgets to handle complex layouts on Web and Desktop without manual math.
๐ New Feature: The Responsive Layout System #
- Added
ResponsiveGrid: The ultimate grid solution.- 6-Tier Support: Now supports specific column counts for Watch, Mobile, Tablet, Small Desktop (New), Desktop, and Large Desktop (New).
- Auto-Fit Mode: Just provide a
minItemWidth(e.g., 150px), and the grid will automatically calculate how many items fit in the row. Perfect for API data. - Lazy Loading: Built-in support for
SliverGridand infinite scrolling performance.
- Added
ResponsiveFlex: A smart widget that automatically switches betweenRow(horizontal) andColumn(vertical) layouts based on screen width. Perfect for profile headers and toolbars. - Added
AdaptiveContainer: Enables Component-Driven Design. This widget rebuilds its child based on its own width (Parent Constraints) rather than the screen size.
๐ฅ๏ธ Desktop & Breakpoint Enhancements #
- Granular Breakpoints: Added
smallDesktop(900px-1200px) andlargeDesktop(>1800px) toResponsiveConfigandResponsiveGrid. You now have control over 6 distinct screen sizes. AppWidthLimiterLogic Upgrade:- Scaling Reset: When
AppWidthLimiterconstrains the app width (e.g., to 1400px), it now injects a new scaling context. - Result: Elements inside the limiter scale relative to the limit (1400px), not the huge screen width (e.g., 4000px). This prevents "Gigantic UI" on ultra-wide monitors.
- Scaling Reset: When
๐ Fixes & Improvements #
- ResponsiveFlex Overflow: Fixed
RenderFlexoverflow issues by implementingmainAxisSize: MainAxisSize.mindefaults. - Grid Stability: Improved
childAspectRatiologic inResponsiveGridto prevent layout breaks on resize. - Documentation: Updated README with comprehensive examples for the new layout widgets.
2.0.2 - 2025-12-06 #
๐ Hotfix #
- Restored API: Fixed missing
context.valueByScreen()method that was accidentally removed in 2.0.1.
2.0.1 - 2025-12-06 ๐ (The Hyper-Performance Update) #
โก Performance Overhaul (Zero Allocation) #
- Zero Allocation Strategy: Completely removed the internal caching layer to eliminate memory allocation overhead. The engine now uses direct O(1) math.
- Inline Optimization: Applied
vm:prefer-inlineto all core extensions (.w,.h,.sp, etc.) to force the compiler to execute getters directly in the hot path. - Smart Equality Checks (Quantization): Implemented Integer-based IDs in
ResponsiveData. This prevents "phantom rebuilds" caused by microscopic floating-point errors (e.g.,100.0vs100.0000001). - Safety Asserts: Added debug-mode assertions to ensure
GlobalResponsiveupdates only happen during valid frame phases.
๐ฆ New Features: Container Queries #
- Added
ScalifyBox: A game-changing widget that allows Local Scaling. Scale UI elements based on their parent container's size, not just the screen size. Perfect for Cards and Grids. - Added
ScalifyFit: Control how content scales inside aScalifyBox(width,height,contain,cover) to handle dynamic aspect ratios automatically.
๐ก๏ธ 4K & Ultra-Wide Protection #
- Smart Dampening Algorithm: Introduced a non-linear scaling logic for screens wider than
1920px(configurable). This prevents UI elements from becoming comically large on TVs or Ultra-wide monitors. - New Config Options: Added
memoryProtectionThresholdandhighResScaleFactortoResponsiveConfig.
๐ ๏ธ Maintenance & Docs #
- 100% Documentation: Added comprehensive Dartdoc comments to all public APIs to meet pub.dev scoring requirements.
- Code Formatting: The entire codebase is now strictly formatted according to Dart standards.
- Resize Debouncing: The provider waits for window resize events to settle before recalculating layout, eliminating lag on Desktop/Web.
2.0.0 - 2025-12-04 ๐ (The Engine Update) #
๐ฆ New Features: Container Queries #
- Added
ScalifyBox: A game-changing widget that allows Local Scaling. Scale UI elements based on their parent container's size, not just the screen size. Perfect for Cards and Grids. - Added
ScalifyFit: Control how content scales inside aScalifyBox(width,height,contain,cover) to handle dynamic aspect ratios automatically.
๐ก๏ธ 4K & Ultra-Wide Protection #
- Smart Dampening Algorithm: Introduced a non-linear scaling logic for screens wider than
1920px(configurable). This prevents UI elements from becoming comically large on TVs or Ultra-wide monitors while saving Texture Memory. - New Config Options: Added
memoryProtectionThresholdandhighResScaleFactortoResponsiveConfig.
โก Ultimate Performance (Zero-Cost) #
- LRU Caching System: Implemented an internal cache for
EdgeInsets(.p) andBorderRadius(.br). This reduces memory allocations by up to 90% during rebuilds. - Resize Debouncing: The provider now waits for the window resize to settle before recalculating layout (Smart Throttling), eliminating lag on Desktop/Web resizing.
- Optimized Getters: Refactored extension getters to access data in O(1) time without unnecessary context lookups in hot paths.
๐ ๏ธ API & DX Improvements #
- Context Shortcuts: Added
context.screenTypegetter for faster checks. - Grid Stability: Fixed layout overflows in dynamic grids using the new
ScalifyFitlogic.
1.0.1 - 2025-12-03 #
๐ก๏ธ Critical Fixes & Null Safety #
- Defensive Programming: Implemented robust null checks using
MediaQuery.maybeOfto prevent crashes when context is invalid. - Safe Fallbacks: Added
ResponsiveData.identityto provide safe default values (fallback) if the provider is not found or during early app initialization. - Web/Desktop Stability: Handled edge cases where screen dimensions might report as 0 during the first frame or window resizing.
- Global Safety:
GlobalResponsive.datano longer throws exceptions but returns safe defaults with a debug warning.
โจ Improvements & Features #
- Two-Axis Scaling: Introduced
scaleWidth(width-driven) andscaleHeight(height-driven) with a smart combined factor for better scaling on ultra-wide or short screens. - ResponsiveConfig Enhancements:
respectTextScaleFactor: When enabled,.fzrespects system accessibility text settings.minScale&maxScale: Added clamping bounds to prevent UI elements from becoming too small or excessively large.outerHorizontalPadding: Added breathing room for width-limited layouts.
- Performance: Added debounce mechanism for window-resize events on Desktop/Web to reduce rebuild churn.
- Validation: Added strict validation for list-based padding shortcuts (accepts lengths of 1, 2, or 4 only) with informative error messages.
- AppWidthLimiter: Now supports optional
horizontalPadding.
๐ Notes #
- Backwards Compatibility: All public extensions (
.w,.h,.fz,.s, etc.) remain fully compatible. - Recommendation: It is highly recommended to wrap your app with
ResponsiveProviderto ensure complete null safety and reactive layout updates.
1.0.0 - 2025-11-24 #
Added #
- Initial release of flutter_scalify
- Responsive extensions for text size (.fz), spacing (.s), icons (.iz), width (.w), height (.h), radius (.r), and UI elements (.ui)
- Padding shortcuts (.p, .ph, .pv, etc.)
- SizedBox shortcuts (.sbh, .sbw)
- BorderRadius shortcuts (.br, .brt, .brb, .brl, .brr)
- ScalifyProvider widget for easy setup
- ResponsiveHelper class with screen type detection
- AppWidthLimiter widget for limiting app width on large screens
- Support for Watch, Mobile, Tablet, Small Desktop, Desktop, and Large Desktop screen sizes
- Beautiful example app demonstrating all features including a responsive grid that adapts to different screen sizes.