createMiddle static method

KeyedSubtree? createMiddle({
  1. required GlobalKey<State<StatefulWidget>> middleKey,
  2. required Widget? userMiddle,
  3. required Widget? userLargeTitle,
  4. required bool large,
  5. required bool automaticallyImplyTitle,
  6. required ModalRoute? route,
})

Implementation

static KeyedSubtree? createMiddle({
  required GlobalKey middleKey,
  required Widget? userMiddle,
  required Widget? userLargeTitle,
  required bool large,
  required bool automaticallyImplyTitle,
  required ModalRoute<dynamic>? route,
}) {
  Widget? middleContent = userMiddle;

  if (large) {
    middleContent ??= userLargeTitle;
  }

  middleContent ??= _derivedTitle(
    automaticallyImplyTitle: automaticallyImplyTitle,
    currentRoute: route,
  );

  if (middleContent == null) {
    return null;
  }

  return KeyedSubtree(
    key: middleKey,
    child: middleContent,
  );
}