flutter - 如何在 Flutter 中更改 TextButton 文本颜色
问题描述
如何在颤动中更改默认 TextButton 文本颜色是我的代码
TextButton(onPressed: null, child: Text('Add Item'))
解决方案
TextButton(
style: TextButton.styleFrom(
backgroundColor: Colors."anyColour", // if you want to change button colour
),
child: Text('Your Text here',
style: TextStyle(
color: Colors."anyColour", // this is for your text colour
),
),
所以你的代码是这样的,我相信
TextButton(onPressed: null,
child: Text('Add Item',
style: TextStyle(
color: Colors."anyColour",
),
),
推荐阅读
- if-statement - 生成 if 条件必须是常量表达式
- javascript - 为什么 redux 不改变状态?
- kotlin - 如何在 Intellij 中配置 Kotlin SDK 外部文档?
- visual-studio - 如何创建 .NET Core 2 MVC 解决方案?
- c# - .NET Core 3.1 无法从 PHP shell_exec() 运行可执行程序
- javascript - 如何在角度的简单对话框模型中从 api 调用返回值?
- docker - 如何在构建阶段将插件添加到 Neo4j Docker 容器,而不是在容器运行时下载插件?
- azure - 如何在 VS 2019 中使用 Azure 云资源管理器
- flutter - 如何在颤动中正确排列物品
- python - 正则表达式用相应的替换模式替换多个模式