buildCounter property
Callback that generates a custom InputDecorator.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 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 semanticsLabel
property.
{@tool snippet}
Widget counter(
BuildContext context,
{
int currentLength,
int maxLength,
bool isFocused,
}
) {
return Text(
'$currentLength of $maxLength characters',
semanticsLabel: 'character count',
);
}
{@end-tool}
If buildCounter returns null, then no counter and no Semantics widget will be created at all.
Implementation
final InputCounterWidgetBuilder? buildCounter;