findDesktopScrollController static method

ScrollController? findDesktopScrollController([
  1. Finder? superTextFieldFinder
])

Implementation

static ScrollController? findDesktopScrollController([Finder? superTextFieldFinder]) {
  final finder = superTextFieldFinder ?? find.byType(SuperTextField);

  final fieldFinder = findInnerPlatformTextField(finder);
  final match = fieldFinder.evaluate().single.widget;
  if (match is! SuperDesktopTextField) {
    return null;
  }

  final textScrollViewElement = find
      .descendant(
        of: finder,
        matching: find.byType(SuperTextFieldScrollview),
      )
      .evaluate()
      .single as StatefulElement;
  final textScrollView = textScrollViewElement.widget as SuperTextFieldScrollview;

  return textScrollView.scrollController;
}