tutorial_coach_mark icon indicating copy to clipboard operation
tutorial_coach_mark copied to clipboard

TargetContent child width expands to fill space

Open adamkoch opened this issue 3 months ago • 0 comments

Not sure if I'm doing something wrong, but I found that all my TargetContent widgets expand to fill the remaining width regardless of what width I set (using say, SizedBox() or Container()). I believe it may have something to do with the fact the tutorial is in an Overlay but I'm not sure.

This is not really noticeable on small screen / mobile devices but once you go to desktop web or ipad/tablet it's noticeable because any text will just be in one long line with no way to limit the width and have the text wrap. Interestingly, setting the height is totally fine and works without issue.

My TargetContent test just looks like this:

TargetContent(
  align: contentAlign,
  child: Container(
    width: 200,
    height: 200,
    color: Colors.red,
  ),
),

With ContentAlign.right, the container sits next to the target and expands right to fill the remaining space: Simulator Screenshot - iPad Air 11-inch (M2) - 2024-05-30 at 16 57 22

With ContentAlign.bottom, the container sits below the target and takes up the full width: Simulator Screenshot - iPad Air 11-inch (M2) - 2024-05-30 at 16 57 29

adamkoch avatar May 30 '24 07:05 adamkoch