像下面这样的简单代码在TextOverflow上失败-用非常长的文本替换“ searchLocationAddress”。颤振1.17.5。所有提供的解决方案-灵活,可扩展等均失败。故障排除的范围缩小到InkWell,如果删除了InkWell,则椭圆率,褪色等将起作用。如果用GestureDetector替换,则会发生与InkWell相同的问题-未应用TextOverFlow。将文字换行以检测点击和动作并仍然应用OverFlow的最佳方法是什么?
Column(
children: <Widget>[
Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
InkWell(
onTap: () => _navigateAndDisplaySelection(),
child: Text(
searchLocationAddress.isEmpty ||
searchLocationAddress == null
? "No Location"
: searchLocationAddress,
overflow: TextOverflow.ellipsis,
),
)
],
),
),
],
);
答案 0 :(得分:0)
我已经弄清楚-最好是将InkWell或GestureDector封装为Container和Expanded或Flexible。以下为我工作:
Column(
children: <Widget>[
Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Flexible(Wrap Container with Flexible or Expanded.
child: Container(//wrap InkWell with Container
child: InkWell(
onTap: () => _navigateAndDisplaySelection(),
child: Text(
searchLocationAddress.isEmpty ||
searchLocationAddress == null
? "No Location"
: searchLocationAddress,
overflow: TextOverflow.ellipsis,
),
),
),
)
],
),
),
],
);