PWEditField constructor
PWEditField({
- @required int? textFieldCount,
- double textFieldWidth = 30,
- double textFieldHeight = 30,
- double textFieldSpace = 3,
- bool autoFocus = false,
- bool obscureText = true,
- bool isDoneClean = false,
- TextStyle textStyle = const TextStyle(fontSize: 12, color: Colors.black54, decoration: TextDecoration.none),
- TextInputType keyboardType = TextInputType.number,
- List<
TextInputFormatter> ? inputFormatters, - BoxDecoration? focusDecoration,
- BoxDecoration? unFocusDecoration,
- ValueChanged<
String> ? onInputDone, - ValueChanged<
String> ? onChanged, - TextEditingController? controller,
- Key? key,
只能输入数字 Only numbers can be entered
inputFormatters = [WhitelistingTextInputFormatter(RegExp("0-9
")),]
Implementation
PWEditField({
@required this.textFieldCount,
this.textFieldWidth = 30,
this.textFieldHeight = 30,
this.textFieldSpace = 3,
this.autoFocus = false,
this.obscureText = true,
this.isDoneClean = false,
this.textStyle = const TextStyle(
fontSize: 12,
color: Colors.black54,
decoration: TextDecoration.none,
),
this.keyboardType = TextInputType.number,
this.inputFormatters,
this.focusDecoration,
this.unFocusDecoration,
this.onInputDone,
this.onChanged,
this.controller,
Key? key,
}) : super(
key: key,
) {
this.controller ??= TextEditingController();
this.focusDecoration ??=
BoxDecoration(
border: Border.all(color: Colors.blue, width: 1),
borderRadius: BorderRadius.all(Radius.circular(2)),
);
this.unFocusDecoration ??=
BoxDecoration(
border: Border.all(color: Colors.grey, width: 1),
borderRadius: BorderRadius.all(Radius.circular(2)),
);
}