String [颤振]:根据ListTile的高度剪切文本

String [颤振]:根据ListTile的高度剪切文本,string,flutter,dart,text,String,Flutter,Dart,Text,我有以下小部件。问题是我需要根据列表的高度和宽度剪切我的字幕字符串。现在,ListTile的高度取决于我拥有的子字符串的长度。我的子字符串越长,listile的高度越长。看起来很尴尬。将listile放入Container小部件内部是好的,但是子字符串与下一个listile内容重叠。看起来也很糟糕。另一个解决方案是使用FittedBox,我想。但是,我需要每个ListTile的固定大小,而不更改fontSize。这就是为什么FixedBox不适合我:)它改变了字体大小。当字符串到达列表的末尾时,

我有以下小部件。问题是我需要根据
列表的高度和宽度剪切我的字幕字符串。现在,ListTile的高度取决于我拥有的子字符串的长度。我的子字符串越长,
listile
的高度越长。看起来很尴尬。将
listile
放入
Container
小部件内部是好的,但是子字符串与下一个
listile
内容重叠。看起来也很糟糕。另一个解决方案是使用
FittedBox
,我想。但是,我需要每个
ListTile
的固定大小,而不更改fontSize。这就是为什么
FixedBox
不适合我:)它改变了字体大小。当字符串到达
列表的末尾时,我需要剪切它。我怎样才能解决这个问题

InkWell(
  onTap: () {
    Navigator.of(context).push(
      MaterialPageRoute(
        builder: (_) => ProductScreen(product),
      ),
    );
  },
  child: Column(
    children: [
      Container(
        padding: const EdgeInsets.symmetric(
          vertical: 8.0,
          horizontal: 4.0,
        ),
        child: ListTile(
          title: Text(
            product.title.toUpperCase(),
            style: Styles.listTitleStyle,
          ),
          subtitle: Text(
            product.description,
            style: Styles.listBodyStyle,
          ),
        ),
      ),
      const Divider(height: 1.0),
    ],

为您的文本小部件添加如下内容:

subtitle: Text(
    maxLines: 2,   //customize your number of lines
    overflow: TextOverflow.ellipsis,    //add this to set (...) at the end of sentence 
    product.description,
    style: Styles.listBodyStyle,
),

为您的文本小部件添加如下内容:

subtitle: Text(
    maxLines: 2,   //customize your number of lines
    overflow: TextOverflow.ellipsis,    //add this to set (...) at the end of sentence 
    product.description,
    style: Styles.listBodyStyle,
),
哇,谢谢)它工作了…哇,谢谢)它工作了。。。