Flutter Showcase long description text in one line

673 Views Asked by At

I am making this showcaseview in my app using this library. But I have a long text as the description. But the text will just be in one line like this:

Showcase image

I really want the text to be in multiple lines. A solution would be to do \n to make it a new line, but i would have to do that every time i think it is a long line, and it would be a nightmare.

Is there a better way i could do this?

This is my code:

Showcase(
            key: _graph,
            title: 'Diagram',
            description:
                'This is a long description. This is a long description. This is a long description. This is a long description. This is a long description. This is a long description. ',
            child: Container(
              height: _size.height * 0.3,
              child: Diagram()
            ),
          ),
2

There are 2 best solutions below

2
AudioBubble On

Show Case View is supposed to provide a short description of your widget not show multi lines and long descriptions.

For a Text you can try this:

Container(
  width: 100,
  child: Text(
    'This is a long description. This is a long description. This is a long description. This is a long description. This is a long description. This is a long description. ',
    maxLines: 2,
    overflow: TextOverflow.ellipsis,
  ),
),
0
Jet On

If you want to provide a longer or custom description try using Showcase.withWidget() instead of just Showcase(). It takes a container property where you can build a custom description widget that incorporates things like RichText().