flutter - 如何知道 SwitchListTile 中的字幕是否为两行或多行?
问题描述
有一个名为isThreeLine
in的属性SwitchListTile
。我想将其值设置为true
仅当我的字幕长度为两行或多行时。我怎么知道?
SwitchListTile(
value: true,
title: Text('Title'),
subtitle: Text('This is going to be a subtitle which is two lines long with isThreeLine: true'),
isThreeLine: false, // only set it to true when my subtitle is 2 or more lines long.
onChanged: null,
)
注意:我不是在寻找任何解决方法,比如玩字符串的总长度等。
解决方案
推荐阅读
- java - 类路径引用的validation-api-1.1.0.Final.jar不存在
- c++ - 是否可以将成员函数指针从 std::bind 更改为 lambda?
- xml - 如何在 Flutter 中将远程 xml 文件转换为字符串?
- c# - 如何控制基于构造函数参数创建的对象类型?
- android - 通知的 RTL 标题左对齐而不是右对齐
- lint - PC-Lint 如何从包含文件中排除消息?
- java - Android:共享首选项给出未知文本
- python - 使用 sklearn.LinearRegression() 时是否有基于 y 值预测 x (x-ose) 值的函数?
- unity3d - OnTriggerEnter2D 和 OnTriggerExit2D 调用了多个时间
- java - 似乎无法将 javaFX JDK 添加到我的项目中