Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add MultiReactionBuilder widget #917

Merged
merged 5 commits into from
Sep 22, 2023

Conversation

amondnet
Copy link
Collaborator

Merges multiple ReactionBuilder widgets into one widget tree.

MultiReactionBuilder improves the readability and eliminates the need to nest multiple ReactionBuilders.

By using MultiReactionBuilder we can go from:

ReactionBuilder(
  builder: (context) {},
  child: ReactionBuilder(
    builder: (context) {},
    child: ReactionBuilder(
      builder: (context) {},
      child: ChildA(),
    ),
  ),
)

to:

MultiReactionBuilder(
  builders: [
    ReactionBuilder(
      builder: (context) {},
    ),
    ReactionBuilder(
      builder: (context) {},
    ),
    ReactionBuilder(
      builder: (context) {},
    ),
  ],
  child: ChildA(),
)

MultiReactionBuilder converts the ReactionBuilder list into a tree of nested ReactionBuilder widgets.
As a result, the only advantage of using MultiReactionBuilder is improved readability due to the reduction in nesting and boilerplate.


Pull Request Checklist

  • If the changes are being made to code, ensure the version in pubspec.yaml is updated.
  • Increment the major/minor/patch/patch-count, depending on the complexity of change
  • Add the necessary unit tests to ensure the coverage does not drop
  • Update the Changelog to include all changes made in this PR, organized by version
  • Run the melo run set_version command from the root directory
  • Include the necessary reviewers for the PR
  • Update the docs if there are any API changes or additions to functionality

@codecov
Copy link

codecov bot commented Apr 14, 2023

Codecov Report

Merging #917 (5ba18f2) into master (9a97f09) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #917   +/-   ##
=======================================
  Coverage   98.99%   98.99%           
=======================================
  Files          56       57    +1     
  Lines        1987     1990    +3     
=======================================
+ Hits         1967     1970    +3     
  Misses         20       20           
Flag Coverage Δ
flutter_mobx 100.00% <100.00%> (ø)
mobx 98.55% <ø> (ø)
mobx_codegen 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
flutter_mobx/lib/src/multi_reaction_builder.dart 100.00% <100.00%> (ø)
flutter_mobx/lib/src/reaction_builder.dart 100.00% <100.00%> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9a97f09...5ba18f2. Read the comment docs.

@amondnet amondnet merged commit 2c2a7bb into mobxjs:master Sep 22, 2023
8 checks passed
@amondnet amondnet added the enhancement New feature or request label Sep 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants