Skip to content

Conversation

@zxnb01
Copy link
Contributor

@zxnb01 zxnb01 commented Sep 29, 2025

What kind of change does this PR introduce?

Bug fix - Fixes snackbar message conflicts and improves UI feedback system

Issue Number:

Fixes #104

Snapshots/Videos:

uploaded in the #104

Summary

This PR addresses critical issues with the snackbar implementation in the canvas screen:

Problems Solved:
Message Overshadowing: The BlocConsumer listener was automatically showing snackbars for any state.message using only CustomSnackbar.showInfo(), which could overshadow other snackbars triggered by user actions (like undo, redo, clear canvas operations)

Limited Snackbar Types: The automatic message system only used showInfo(), preventing the use of showSuccess() or showError() snackbars for appropriate contextual feedback

Inefficient State Management: The system required a message parameter in the state that needed to be manually cleared after each use, leading to unnecessary state updates and potential race conditions

Changes Made:
✅ Removed message field from CanvasState and related state management methods
✅ Replaced automatic snackbar display in BlocConsumer listener with direct calls to appropriate CustomSnackbar methods
✅ Implemented proper success (green), error (red), and info (blue) snackbar types with contextual feedback
✅ Eliminated the need for clearMessage() method and related state updates
✅ Improved separation of concerns between business logic and UI feedback

Does this PR introduce a breaking change?

no

Other information

Testing performed:
✅ Verified success snackbars display correctly for save operations
✅ Verified info snackbars display correctly for informational messages
✅ Confirmed no snackbar message conflicts occur during rapid operations
✅ Ensured all existing functionality works as expected

Have you read the contributing guide , README.md , code of conduct?

yes

@github-actions
Copy link
Contributor

Our Pull Request Approval Process

Thanks for contributing!

Reviewers

Do not assign reviewers. Our Queue Monitors will review your PR and assign them.
When your PR has been assigned reviewers contact them to get your code reviewed and approved via:

  1. comments in this PR

Reviewing Your Code

Your reviewer(s) will have the following roles:

  1. arbitrators of future discussions with other contributors about the validity of your changes
  2. point of contact for evaluating the validity of your work
  3. person who verifies matching issues by others that should be closed.
  4. person who gives general guidance in fixing your tests

Other

🎯 Please be considerate of our volunteers' time. Contacting the person who assigned the reviewers is not advised unless they ask for your input. Do not @ the person who did the assignment otherwise.

@may-tas
Copy link
Owner

may-tas commented Sep 29, 2025

@zxnb01 add a working recording.

@may-tas
Copy link
Owner

may-tas commented Sep 29, 2025

@zxnb01 The dialogs seem to be appearing twice because CustomSnackBar is called in both the screens/UI code and the cubit. Please make sure to remove one and keep it in a single location.

@zxnb01
Copy link
Contributor Author

zxnb01 commented Sep 30, 2025

@may-tas , removed the duplication of snackbar.
All business logic feedback is now centralized in the CanvasCubit, ensuring each operation shows exactly one snackbar message.

User Actions That Trigger Snackbars:

1.Canvas Operations

  • Enter drawing mode - info
  • Clear canvas/drawings - info
  • Undo/Redo actions -info

2.Page Management

  • Save current page - green
  • Delete saved page - green
  • Create new page - info

3.Background Operations

  • Upload image from gallery - green
  • Capture photo with camera - green
  • Remove background image - info
  • Change background color -green

4.the red snackbar triggers in time of failure

Untitled.video.-.Made.with.Clipchamp.mp4

@may-tas
Copy link
Owner

may-tas commented Sep 30, 2025

@zxnb01, please remove the snackbar for redo/undo features. Users will use redo/undo frequently, causing snackbars to stack on top of each other.
Everything else looks good.

@may-tas
Copy link
Owner

may-tas commented Sep 30, 2025

@zxnb01, I kindly ask you to star ⭐ the repository and encourage your friends and fellow contributors to do the same. By doing so, we can significantly expand the visibility and reach of our project.
Additionally, I want to highlight that this repository will be participating in Hacktoberfest, providing a great opportunity for everyone to contribute and make a meaningful impact in the open-source community.

@zxnb01
Copy link
Contributor Author

zxnb01 commented Sep 30, 2025

hacktoberfest labels will begin from oct 1?

@zxnb01
Copy link
Contributor Author

zxnb01 commented Sep 30, 2025

@zxnb01, please remove the snackbar for redo/undo features. Users will use redo/undo frequently, causing snackbars to stack on top of each other. Everything else looks good.

okay, it was present from before so i didnt remove that. ill do it.

@may-tas
Copy link
Owner

may-tas commented Sep 30, 2025

Yes

hacktoberfest labels will begin from oct 1?

@may-tas may-tas changed the title snackbar fix fix: conflicting snackbars Sep 30, 2025
@may-tas may-tas merged commit 662621d into may-tas:main Sep 30, 2025
@zxnb01 zxnb01 deleted the fix/snackbar-conflicts branch September 30, 2025 16:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug Report : Inefficient Snackbar System Causing Message Conflicts

2 participants