PPTextField constructor
const
PPTextField({
- Key? key,
- required TextEditingController controller,
- required String labelText,
- TextStyle labelStyle = const TextStyle(color: Colors.grey, fontSize: 18),
- Color fillColor = const Color(0xFFEEEEEE),
- double borderRadius = 12.0,
- BorderSide borderSide = BorderSide.none,
- BorderSide focusedBorderSide = const BorderSide(color: Colors.blue, width: 1.0),
- BorderSide errorBorderSide = const BorderSide(color: Colors.red, width: 1.0),
- Color clearColor = const Color(0xFFBDBDBD),
- int maxLength = 50,
- bool showCounter = false,
Implementation
const PPTextField({
super.key,
required this.controller,
required this.labelText,
this.labelStyle = const TextStyle(color: Colors.grey, fontSize: 18),
this.fillColor = const Color(0xFFEEEEEE), // 默认灰色背景
this.borderRadius = 12.0,
this.borderSide = BorderSide.none,
this.focusedBorderSide =
const BorderSide(color: Colors.blue, width: 1.0), // 聚焦时的边框样式
this.errorBorderSide =
const BorderSide(color: Colors.red, width: 1.0), // 错误时的边框样式
this.clearColor = const Color(0xFFBDBDBD), // 默认灰色取消按钮
this.maxLength = 50, // 新增的最大长度属性
this.showCounter = false, // 默认不显示计数器
});