MTextController constructor
MTextController(
{ - String? name,
- required int maxInput,
- bool mustInput = true,
- String? defText,
})
Implementation
MTextController(
{this.name,
required this.maxInput,
this.mustInput = true,
String? defText}) {
if (GetUtils.isNullOrBlank(defText)?.not() ?? false) {
text = defText!;
}
this.addListener(() {
if (this.text.length > maxInput) {
this.text = this.text.substring(0, maxInput);
this.selection =
TextSelection.fromPosition(TextPosition(offset: this.text.length));
mShowCustomToast('Please enter less than $maxInput characters');
}
});
}