flutter - 我们可以在颤动中设置一个可点击的 SpanText 吗?
问题描述
RichText(
text: TextSpan(
text: 'NEW USER ?',
style: TextStyle(color: Colors.grey),
children: <TextSpan>[
TextSpan(
text: ' SIGN UP',
style: TextStyle(color: Colors.blue),
)
],
),
),
在这里,我想在点击“SIGN UP”时做一些事情。
解决方案
TextSpan
具有recognizer
可以点击给定小部件的属性。
TextSpan(
text: ' SIGN UP',
style: TextStyle(color: Colors.blue),
)
recognizer: TapGestureRecognizer()
..onTap = () {
// do something here
}),
)
推荐阅读
- kotlin - 使用 Dagger Hilt 解决多个字符串的注入
- amazon-redshift - 将 `GETDATE()` Redshift 函数与 psycopg2 execute_values 一起使用
- python - Python:cmath 为 e^(i*pi) 返回错误值
- reactjs - 样式化反应流程图的最佳实践是什么?
- git - git 远程添加源 docker 容器
- python - IntegrityError:UNIQUE 约束失败:theatre_audience.ticketId
- output - 如何正确读取 VHDL 中的“部分未定义”信号
- php - 在 codeigniter 中使用 base_url 自动调用图像名称
- accessibility - 使用 pa11y 的命令行界面时不断收到超时错误和“taskkill”
- swift - 将 RealmSwift 数据迁移到 Core Data,移除 RealmSwift 依赖?