Skip to content

Conversation

@Platohykj
Copy link

Fix issue #1620
This pull request refines how the system back button is handled in the app bar, especially distinguishing between edit and search modes. The main improvement ensures that the system back button is only blocked during edit mode, not search mode, leading to a more intuitive user experience.

Back button handling improvements:

  • Updated _buildAppBarWrap in CommonScaffoldState so that SystemBackBlock is only applied during edit mode, allowing the system back button to function normally during search mode. (lib/widgets/scaffold.dart) [1] [2]
  • Refactored the dispose method in _SystemBackBlockState to immediately call unBackBlock before super.dispose(), ensuring proper cleanup without unnecessary post-frame callbacks. (lib/widgets/pop_scope.dart)

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors back button handling in CommonScaffold to fix issue #1620 by distinguishing between edit and search modes. The key improvement ensures the system back button is only blocked during edit mode (to prevent accidental data loss), while allowing normal back button behavior during search mode for better user experience.

Key Changes:

  • Modified _buildAppBarWrap to conditionally apply SystemBackBlock only in edit mode, not search mode
  • Simplified the dispose method in _SystemBackBlockState to call cleanup directly before super.dispose() instead of using an unnecessary post-frame callback

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
lib/widgets/scaffold.dart Refactored _buildAppBarWrap to wrap the app bar with SystemBackBlock only when in edit mode, allowing the system back button to function normally during search mode while maintaining the CommonPopScope wrapper for both modes
lib/widgets/pop_scope.dart Improved the dispose method by calling unBackBlock() directly before super.dispose() instead of scheduling it in a post-frame callback, ensuring proper and immediate cleanup

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant