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

Cannot align DescribedFeatureOverlay to the right middle of the screen #62

Open
limsocheat opened this issue Nov 28, 2020 · 3 comments · May be fixed by #71
Open

Cannot align DescribedFeatureOverlay to the right middle of the screen #62

limsocheat opened this issue Nov 28, 2020 · 3 comments · May be fixed by #71

Comments

@limsocheat
Copy link

I tried to display DescribedFeatureOverlay to the widget locates on the middle left of the screen.

Screenshot_1606553405

prefixIcon: DescribedFeatureOverlay(
  featureId: 'date',
  tapTarget: Icon(Icons.calendar_today),
  contentLocation: ContentLocation.above,
  overflowMode: OverflowMode.clipContent,
  title: Text('Date'),
  description:
      Text('Choose the date from calendar'),
  child: Icon(Icons.calendar_today),
),
@limsocheat limsocheat changed the title content not showing correctly when placed on middle left of the screen Cannot align DescribedFeatureOverlay to the right middle of the screen Nov 28, 2020
@ycv005
Copy link

ycv005 commented Dec 11, 2020

I want this features to added. Facing same problem. Even ContentLocation.trivial don't works. @ayalma

@ycv005
Copy link

ycv005 commented Mar 5, 2021

hey @limsocheat , you can edit source file - flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/feature_discovery-0.13.0+2/lib/src/foundation/feature_discovery.dart

enum ContentLocation {
  above,
  below,
  trivial,
  right, // add this
}

this file - flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/feature_discovery-0.13.0+2/lib/src/widgets/overlay.dart

  Offset _backgroundPosition(Offset anchor, ContentLocation contentLocation) {
    final width = min(_screenSize.width, _screenSize.height);
    final isBackgroundCentered = _isCloseToTopOrBottom(anchor);

    if (isBackgroundCentered) {
      return anchor;
    } else {
      final startingBackgroundPosition = anchor;

      Offset endingBackgroundPosition;
      switch (contentLocation) {
       // add this case
        case ContentLocation.right:
          endingBackgroundPosition =
              Offset(width / 2.0, anchor.dy + (width / 4.0));
          break;

Now, it will work.

@JTPenn-EG
Copy link

Any updates on this ?

abahnj added a commit to abahnj/feature_discovery that referenced this issue May 25, 2021
fixes an issue that occurs when the feature discovery is called with a
widget that is aligned to the right of the screen

fixes ayalma#62
abahnj added a commit to abahnj/feature_discovery that referenced this issue May 25, 2021
fixes an issue that occurs when the feature discovery is called with a
widget that is aligned to the right of the screen

fixes ayalma#62
@abahnj abahnj linked a pull request May 25, 2021 that will close this issue
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 a pull request may close this issue.

3 participants