flutter - 在 Flutter 中的 TextField 下显示错误
问题描述
Material Design 允许文本字段通过输入框下方的红色小标签来指示错误:https ://material.io/components/text-fields (见下面的截图)。
有没有办法为TextField
Flutter 中的某个领域实现这一目标?我希望这是TextField
or的属性TextEditingController
,但还没有找到类似的东西。
解决方案
它存在于 TextField 的装饰属性中,您也可以使用它的样式属性对其进行样式设置。
TextField(
decoration: InputDecoration(
errorStyle: TextStyle(),
errorText: 'Please enter something'
),
),
推荐阅读
- maven - 在多模块项目中构建可部署的 jar
- laravel - Laravel 路由中间件认证
- java - 从 Firebase 获取特定数据(图像)的问题
- python - 导入matplotlib时如何解决这个问题
- css - Border-radius 正在剪裁我在 div 内的图像。可见溢出不起作用
- facebook - 来自 reddit 的帖子如何在 Facebook 应用中自动打开?
- apache-flink - 有没有办法在全局窗口中找到元素的年龄?
- apache - 检索不记名访问令牌时打开 JPA 错误
- node.js - 如何在 Angular 项目中从默认 npmjs 存储库切换到 Artifactory 存储库
- php - Woocommerce - 从 csv 文件导入产品