onChanged method
void
onChanged( - T? value,
- string? textValue
)
Implementation
void onChanged(T? value, string? textValue) {
if (widget.max != null && widget.max! > 0) {
if (isSameType<T, num>() || isSameType<T, double>() || isSameType<T, int>()) {
value = (value as num).clampMax(widget.max!) as T;
}
textValue = textValue?.first(_maxLen!);
this._textController.text = textValue!;
}
if (widget.debounce == null) {
widget.onChanged(value, textValue);
} else {
if (_debounce?.isActive ?? false) _debounce?.cancel();
_debounce = Timer(widget.debounce!, () async {
widget.onChanged(value, textValue);
setState(() {});
});
}
}