bloc_morph 0.3.0
bloc_morph: ^0.3.0 copied to clipboard
A Flutter widget for elegant state management with Bloc, animating transitions between loading, error, empty, and content states.
BlocMorph #
A powerful and flexible Flutter package for managing UI states with the Bloc pattern, featuring smooth animations and highly customizable widgets. BlocMorph simplifies handling various UI states like loading, error, empty, and network issues, while providing seamless transitions and a polished user experience.
📜 Changelog #
Changelog #
All notable changes to the BlocMorph widget will be documented in this file.
0.3.0 2024-Sep-24 #
- Refactor: Renamed
TypeStatetoStatusStateto align with common state management terminologies, where "status" (e.g., loading, success, error) is a more conventional term than "type" for describing the current state of an operation. - Refactor: Renamed
disableAnimationtoisDisableAnimationfor boolean properties. - Refactor: Updated
PaginatingBlocandPaginatingStateto useStatusState, aligning them with changes inMorphState. - Feature: Added
fadeInAnimationandfadeOutAnimationparameters for customizing fade-in and fade-out animations inAnimatedSwitcher. This allows users to tailor transition effects for a better user experience. - Docs: Updated documentation and examples to reflect the renaming of
TypeStatetoStatusState.
0.2.5 2025-Sep-23 #
- Fixed The key of
AnimatedSwitcherwas corrected to fix issues with state transitions, especially for pagination. Previously, the key was not always unique, causing problems with animations and widget updates. Now, a uniqueValueKeyis generated using therequestKeyfromMorphStateto ensure proper behavior during transitions. - Improved
_buildErrorWidgetand_buildNetworkErrorWidgetnow useRichTextfor error messages to allow selective text scaling. This ensures that only the error message text scales according to accessibility settings, while other elements like icons and button text remain at their defined sizes. - Improved The logic for determining the icon and text style in
_buildErrorWidgetand_buildNetworkErrorWidgethas been refactored for clarity and to better support platform-specific styling. - Improved Minor refactoring and code cleanup in
_BlocMorphStatefor better readability and maintenance.
0.2.2 2025-Sep-20 #
Added #
- Type Safety with
MorphStateInterface: Introduced aMorphStateinterface to enforce type-safe access torequestKey,typeState, anderrorproperties, eliminating unsafedynamiccasting. - Accessibility Support: Added
Semanticswidgets to default state widgets (_buildErrorWidget,_buildEmptyWidget,_buildInitWidget,_buildNetworkErrorWidget) to support screen readers and improve accessibility. IncludedtextScalerfor text scaling based on device accessibility settings. - Platform Style Support: Added
PlatformStyleenum (material,cupertino) to allow default widgets to adapt to Material or Cupertino design systems based on theplatformStyleparameter. - Customizable Error Padding and Icon Size: Added
errorPaddinganderrorIconSizeparameters to allow customization of padding and icon size in error and network error states. - Comprehensive Documentation: Added detailed DartDoc comments for all constructor parameters of
BlocMorph, explaining their purpose, default behavior, and usage.
Changed #
- Refactored
BlocConsumerListener Logic: Simplified the listener logic in_BlocMorphStateto reduce code duplication and improve readability by consolidating theifandelsebranches for state handling. - Optimized
AnimatedSwitcherUsage: MovedAnimatedSwitcherlogic into_buildContentto apply animations only whendisableAnimationisfalse, reducing unnecessary widget tree complexity. - Improved Key Management: Ensured all branches in
_buildContentuse uniqueValueKeys forKeyedSubtreewidgets to prevent animation glitches inAnimatedSwitcher. - Enhanced Error Handling: Updated
errorBuilderto receive the actual error message from theMorphState.errorfield instead of an empty string, improving flexibility for custom error displays. - Renamed
_buildErrorWidgetIOS: Renamed to_buildErrorWidgetfor clarity and consistency, as it now supports both Material and Cupertino styles. - Fixed Documentation Example: Corrected a syntax error in the example code in the
BlocMorphdocumentation, fixing theonPressedcallback (yourFuctoyourFunction) and ensuring proper syntax.
Fixed #
- Null-Safety for Callbacks: Added null-safety checks for optional callbacks (
onNext,onState,onTry) using the?.operator to prevent runtime null pointer exceptions. - Animation Key Issues: Fixed potential animation glitches by ensuring all state widgets in
_buildContenthave unique keys, particularly for pagination and non-pagination cases.
0.1.4 2025-Sep-18 #
- Initial Commit
Built with ❤️ for the PuzzleTakX