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

fix: Added contentdxOffset #80

Merged
merged 5 commits into from
Nov 29, 2023

Conversation

kasyanyukd1995
Copy link
Contributor

@kasyanyukd1995 kasyanyukd1995 commented Nov 27, 2023

I added contentDxOffset

Summary by CodeRabbit

  • New Features

    • Introduced an option to adjust the horizontal positioning of popover content with a new contentDxOffset parameter.
  • Enhancements

    • Improved popover dismissal handling by utilizing PopScope instead of `WillPopScope.
  • Refactor

    • Updated internal calculations for popover positioning to support the new horizontal offset feature.

Copy link
Contributor

coderabbitai bot commented Nov 27, 2023

Walkthrough

The updates involve adding a new parameter contentDxOffset to the showPopover function and the PopoverItem class, enabling horizontal offset customization for popover content. Additionally, there's a change in the dialog route creation, replacing WillPopScope with PopScope to manage popover dismissals.

Changes

File Path Change Summary
lib/src/popover.dart Introduced contentDxOffset parameter to showPopover function; replaced WillPopScope with PopScope.
lib/src/popover_item.dart Added contentDxOffset property to PopoverItem class; adjusted _attachRect calculation in _PopoverItemState.

Poem

🐇 "In the realm of code, where popovers float,
A new offset parameter, we proudly denote.
Shift to the left, or glide to the right,
With contentDxOffset, your UI takes flight!" 🎈


Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • If you reply to a review comment from CodeRabbit, the bot will automatically respond.
  • To engage with CodeRabbit bot directly around the specific lines of code in the PR, mention @coderabbitai in your review comment
  • Note: Review comments are made on code diffs or files, not on the PR overview.
  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Note: For conversation with the bot, please use the review comments on code diffs or files.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between d86ef98 and eb05616.
Files selected for processing (2)
  • lib/src/popover.dart (3 hunks)
  • lib/src/popover_item.dart (3 hunks)
Additional comments: 7
lib/src/popover.dart (4)
  • 56-58: The addition of the contentDxOffset parameter with a default value of 0 is correctly implemented and follows the pattern of other offset parameters in the function.

  • 139-139: The contentDxOffset parameter is correctly passed to the PopoverItem constructor, ensuring that the new feature is integrated into the popover's layout logic.

  • 56-58: The documentation for the contentDxOffset parameter is clear and consistent with the existing documentation style for other parameters.

  • 95-95: The default value of 0 for contentDxOffset is a safe choice as it maintains the current behavior when the parameter is not explicitly set by the user.

lib/src/popover_item.dart (3)
  • 144-148: The implementation of contentDxOffset in _configureRect looks correct and should allow for the intended horizontal offset adjustment of the popover content.

  • 37-40: The default values for contentDxOffset and other offset properties are set to 0, which is good for maintaining backward compatibility.

  • 144-148: Ensure that the arrowWidth property is always non-null when it's being used in the _configureConstraints method, as it's added to maxWidth without a null check.

@kasyanyukd1995 kasyanyukd1995 changed the title added contentdxOffset fix: added contentdxOffset Nov 27, 2023
@minikin minikin self-requested a review November 27, 2023 08:35
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 1

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between eb05616 and b38d815.
Files selected for processing (1)
  • lib/src/popover.dart (4 hunks)
Additional comments: 3
lib/src/popover.dart (3)
  • 56-58: The addition of the contentDxOffset parameter to the showPopover function is correctly implemented with a default value of 0, which is a safe default that maintains backward compatibility.

  • 122-122: The PopScope widget is not a standard Flutter widget. Verify if it is a custom widget and ensure it is correctly implemented and tested.

  • 85-101: The logic to handle constraints based on width and height is correctly implemented, ensuring that the popover respects the provided dimensions if any.

lib/src/popover.dart Outdated Show resolved Hide resolved
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between b38d815 and d419f58.
Files selected for processing (1)
  • lib/src/popover.dart (4 hunks)
Additional comments: 4
lib/src/popover.dart (4)
  • 119-123: Verify the implementation of PopScope as it is not a standard Flutter widget. Ensure that it properly handles the on-pop callback and that it is tested for the intended behavior.

  • 98-98: The contentDxOffset parameter is correctly added with a default value of 0, which is consistent with the summary and the documentation.

  • 146-146: The barrierLabel is correctly handled with a fallback to MaterialLocalizations.of(context).modalBarrierDismissLabel when it is null.

  • 149-149: The transitionBuilder is correctly handled with a fallback to a default FadeTransition when null.

@kasyanyukd1995 kasyanyukd1995 changed the title fix: added contentdxOffset fix: Added contentdxOffset Nov 27, 2023
@minikin minikin added the enhancement New feature or request label Nov 27, 2023
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between d419f58 and 0cca23f.
Files selected for processing (1)
  • lib/src/popover.dart (4 hunks)
Additional comments: 2
lib/src/popover.dart (2)
  • 53-62: The addition of contentDxOffset to the showPopover function is consistent with the summary and allows for horizontal positioning of the popover content. Ensure that the PopoverItem class is updated accordingly to handle this new parameter.

  • 136-148: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [119-148]

The replacement of WillPopScope with PopScope for handling popover dismissal behavior is consistent with the summary. Verify that PopScope is a valid widget and that the onPopInvoked callback is correctly implemented to handle the dismissal.

@minikin
Copy link
Owner

minikin commented Nov 28, 2023

@kasyanyukd1995 let's bump SDK and Flutter versions to the latest stable, please:

environment:
  sdk: '>=3.2.1 <4.0.0'
  flutter: '>=3.16.1'

@minikin
Copy link
Owner

minikin commented Nov 29, 2023

@kasyanyukd1995 thank you for your contribution! I'll cut a new release tomorrow.

@minikin minikin merged commit e66db75 into minikin:main Nov 29, 2023
3 checks passed
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