简体   繁体   English

Flutter 在一行中展示长描述文本

[英]Flutter Showcase long description text in one line

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:但是文本将只是这样的一行:

展示图片

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.一个解决方案是做\n使它成为一条新线,但每次我认为它是一条长线时我都必须这样做,这将是一场噩梦。

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()
            ),
          ),

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,
  ),
),

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM