hasFocus static method

bool hasFocus([
  1. Finder? finder
])

Returns true if the given SuperReader widget currently has focus, or false otherwise.

By default, this method expects a single SuperReader in the widget tree and finds it byType. To specify one SuperReader among many, pass a superDocumentFinder.

Implementation

static bool hasFocus([Finder? finder]) {
  final element = (finder ?? find.byType(SuperReader)).evaluate().single as StatefulElement;
  final superDocument = element.state as SuperReaderState;
  return superDocument.focusNode.hasFocus;
}