feat: cascade negative deltas - #88
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds a new feature that cascades negative deltas when a resizable child reaches its lower bound, passing the remaining delta to its adjacent siblings. Key changes include:
- Updating test cases in test/resizable_container_test.dart to validate the cascading behavior.
- Enhancing the logic in lib/src/resizable_controller.dart to handle both leftward and rightward cascaded delta distribution.
- Extending the ResizableContainer widget and example apps to enable and showcase the new cascadeNegativeDelta flag.
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| test/resizable_container_test.dart | Added tests verifying that negative deltas cascade to sibling containers. |
| lib/src/resizable_controller.dart | Introduced cascadeNegativeDelta logic in delta distribution and refactored helper methods for left & right sibling adjustments. |
| lib/src/resizable_container.dart | Updated widget API to accept the cascadeNegativeDelta flag and propagate it to the controller. |
| example/** | Added new example screen and navigation updates to demonstrate the cascading delta feature. |
Comments suppressed due to low confidence (1)
lib/src/resizable_controller.dart:228
- Review the use of max() here to ensure it correctly computes the effective change, especially when both allowableChange and remainingDelta might be negative. Confirm that this logic meets the intended cascading behavior.
final effectiveChange = max(allowableChange, remainingDelta);
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a new feature that cascades negative deltas to sibling elements when a child reaches its lower bound. Key changes include new widget properties and controller logic to enable cascading behavior as well as updates to tests and example screens.
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| test/resizable_container_test.dart | Added tests to verify cascading behavior for negative deltas. |
| lib/src/resizable_controller.dart | Updated controller logic to support negative delta cascading with new distribution functions. |
| lib/src/resizable_container.dart | Introduced a new cascadeNegativeDelta property and updated state management. |
| example/pubspec.yaml | Registered the new cascading_delta example screen. |
| example/lib/widgets/nav_drawer.dart | Added a navigation entry for the cascading delta example. |
| example/lib/screens/cascading_delta/cascading_delta_screen.dart | Created a new example screen demonstrating the cascading delta feature. |
| example/lib/screens/cascading_delta/cascading_delta_help_dialog.dart | Added a help dialog with usage instructions for the new feature. |
| example/lib/main.dart | Updated routes to include the cascading delta screen. |
| example/lib/file_asset_paths.dart | Updated asset paths to include the cascading delta screen asset. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds a new feature that "cascades" negative deltas if the target child reaches its lower bound.
For example, if ChildA is resized down to its lower bound of 100px but the divider is dragged, this delta will be passed to its nearest sibling. If this sibling is at its lower bound, the delta will cascade to the next sibling, and so on.
This resolves #84