bloc_morph 0.3.7+8
bloc_morph: ^0.3.7+8 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 #
0.3.7+8 - 2024-10-07 #
- Feature: Added
MorphSelectorwidget (generic<T>):- Rebuilds only when a state of type
<T>is emitted from a Bloc. - Optional
initialvalue to display before receiving a state. - Optional
placeholderwidget for displaying loading/fallback UI before<T>state arrives. - Fully generic and reusable for package-level usage.
- Rebuilds only when a state of type
- Feature: Added
MorphSelectorMultiplewidget:- Supports listening to multiple state types or selected values.
- Rebuilds only when any of the tracked values changes.
- Optional
initialandplaceholdersupport. - Ideal for complex Blocs with multiple relevant states.
- Docs: Added English documentation and examples for
MorphSelectorandMorphSelectorMultiple.
0.3.3+4 - 2024-09-27 #
- Feature: Added
paginationLoadingBuilder,paginationErrorBuilder, andpaginationEmptyBuilderto allow custom widgets for pagination states. This provides greater flexibility in customizing the UI for different pagination scenarios. - Fix: Resolved an issue where
networkErrorWidgetanderrorWidgetwere not displayed when pagination was disabled. This ensures that the appropriate error widgets are shown regardless of the pagination state. - Fix: Corrected the logic in
BlocMorphto ensure thatloadingWidgetis displayed correctly during initial loading and pagination. Previously, the loading widget might not have been shown consistently in all loading scenarios. - Chore: Updated package dependencies to their latest versions to ensure compatibility and leverage the latest features and bug fixes.
- Docs: Improved and updated the documentation, including examples, to reflect the latest changes and provide clearer guidance on using the package.
- Docs: Added Persian (Farsi) translation for the README and examples.
0.3.1+1 - 2024-09-24 #
- Fixed Minor bug fixes and performance improvements.
0.3.0 - 2024-09-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 - 2024-09-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 - 2024-09-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 - 2024-09-18 #
- Initial Commit
Built with ❤️ for the PuzzleTakX