buildCounter property
final
Callback that generates a custom InputDecoration.counter widget.
See InputCounterWidgetBuilder for an explanation of the passed in arguments. The returned widget will be placed below the line in place of the default widget built when InputDecoration.counterText is specified.
The returned widget will be wrapped in a Semantics widget for accessibility, but it also needs to be accessible itself. For example, if returning a Text widget, set the Text.semanticsLabel property.
link
Widget counter(
BuildContext context,
{
required int currentLength,
required int? maxLength,
required bool isFocused,
}
) {
return Text(
'$currentLength of $maxLength characters',
semanticsLabel: 'character count',
);
}
If buildCounter returns null, then no counter and no Semantics widget will be created at all.
Implementation
final InputCounterWidgetBuilder? buildCounter;