feature_discovery icon indicating copy to clipboard operation
feature_discovery copied to clipboard

Cannot align DescribedFeatureOverlay to the right middle of the screen

Open limsocheat opened this issue 4 years ago • 3 comments

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 avatar Nov 28 '20 08:11 limsocheat

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

ycv005 avatar Dec 11 '20 07:12 ycv005

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.

ycv005 avatar Mar 05 '21 19:03 ycv005

Any updates on this ?

JTPenn-EG avatar Apr 25 '21 12:04 JTPenn-EG