buildCounter property

InputCounterWidgetBuilder buildCounter
final

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.

Widget counter(
  BuildContext context,
  {
    int currentLength,
    int maxLength,
    bool isFocused,
  }
) {
  return Text(
    '$currentLength of $maxLength characters',
    semanticsLabel: 'character count',
  );
}

Implementation

final InputCounterWidgetBuilder buildCounter