findTitle static method

String? findTitle(
  1. Element element
)

Implementation

static String? findTitle(Element element) {
  String? title;
  walkElement(element, (child, _) {
    if (child.widget is NavigationToolbar) {
      NavigationToolbar toolBar = child.widget as NavigationToolbar;
      if (toolBar.middle == null) {
        return false;
      }

      if (toolBar.middle is Text) {
        title = (toolBar.middle as Text).data;
        return false;
      }

      int layoutIndex = 0;
      if (toolBar.leading != null) {
        layoutIndex += 1;
      }
      title = findTextsInMiddle(child, layoutIndex);
      return false;
    }
    return true;
  });
  return title;
}