bloc_morph 0.3.7+8 copy "bloc_morph: ^0.3.7+8" to clipboard
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 #

BlocMorph Logo

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.

Pub Version License Flutter Version Dart Version

📜 Changelog #

Changelog #

0.3.7+8 - 2024-10-07 #

  • Feature: Added MorphSelector widget (generic <T>):
    • Rebuilds only when a state of type <T> is emitted from a Bloc.
    • Optional initial value to display before receiving a state.
    • Optional placeholder widget for displaying loading/fallback UI before <T> state arrives.
    • Fully generic and reusable for package-level usage.
  • Feature: Added MorphSelectorMultiple widget:
    • Supports listening to multiple state types or selected values.
    • Rebuilds only when any of the tracked values changes.
    • Optional initial and placeholder support.
    • Ideal for complex Blocs with multiple relevant states.
  • Docs: Added English documentation and examples for MorphSelector and MorphSelectorMultiple.

0.3.3+4 - 2024-09-27 #

  • Feature: Added paginationLoadingBuilder, paginationErrorBuilder, and paginationEmptyBuilder to allow custom widgets for pagination states. This provides greater flexibility in customizing the UI for different pagination scenarios.
  • Fix: Resolved an issue where networkErrorWidget and errorWidget were 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 BlocMorph to ensure that loadingWidget is 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 TypeState to StatusState to 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 disableAnimation to isDisableAnimation for boolean properties.
  • Refactor: Updated PaginatingBloc and PaginatingState to use StatusState, aligning them with changes in MorphState.
  • Feature: Added fadeInAnimation and fadeOutAnimation parameters for customizing fade-in and fade-out animations in AnimatedSwitcher. This allows users to tailor transition effects for a better user experience.
  • Docs: Updated documentation and examples to reflect the renaming of TypeState to StatusState.

0.2.5 - 2024-09-23 #

  • Fixed The key of AnimatedSwitcher was 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 unique ValueKey is generated using the requestKey from MorphState to ensure proper behavior during transitions.
  • Improved _buildErrorWidget and _buildNetworkErrorWidget now use RichText for 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 _buildErrorWidget and _buildNetworkErrorWidget has been refactored for clarity and to better support platform-specific styling.
  • Improved Minor refactoring and code cleanup in _BlocMorphState for better readability and maintenance.

0.2.2 - 2024-09-20 #

Added #

  • Type Safety with MorphState Interface: Introduced a MorphState interface to enforce type-safe access to requestKey, typeState, and error properties, eliminating unsafe dynamic casting.
  • Accessibility Support: Added Semantics widgets to default state widgets (_buildErrorWidget, _buildEmptyWidget, _buildInitWidget, _buildNetworkErrorWidget) to support screen readers and improve accessibility. Included textScaler for text scaling based on device accessibility settings.
  • Platform Style Support: Added PlatformStyle enum (material, cupertino) to allow default widgets to adapt to Material or Cupertino design systems based on the platformStyle parameter.
  • Customizable Error Padding and Icon Size: Added errorPadding and errorIconSize parameters 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 BlocConsumer Listener Logic: Simplified the listener logic in _BlocMorphState to reduce code duplication and improve readability by consolidating the if and else branches for state handling.
  • Optimized AnimatedSwitcher Usage: Moved AnimatedSwitcher logic into _buildContent to apply animations only when disableAnimation is false, reducing unnecessary widget tree complexity.
  • Improved Key Management: Ensured all branches in _buildContent use unique ValueKeys for KeyedSubtree widgets to prevent animation glitches in AnimatedSwitcher.
  • Enhanced Error Handling: Updated errorBuilder to receive the actual error message from the MorphState.error field instead of an empty string, improving flexibility for custom error displays.
  • Renamed _buildErrorWidgetIOS: Renamed to _buildErrorWidget for 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 BlocMorph documentation, fixing the onPressed callback (yourFuc to yourFunction) 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 _buildContent have unique keys, particularly for pagination and non-pagination cases.

0.1.4 - 2024-09-18 #

  • Initial Commit

Built with ❤️ for the PuzzleTakX

1
likes
145
points
0
downloads

Publisher

verified publisherpuzzletak.ir

Weekly Downloads

A Flutter widget for elegant state management with Bloc, animating transitions between loading, error, empty, and content states.

Homepage
Repository (GitHub)
View/report issues

Documentation

Documentation
API reference

License

Apache-2.0 (license)

Dependencies

flutter, flutter_bloc

More

Packages that depend on bloc_morph