of<T> static method

OpenMenu<T> of<T>(
  1. BuildContext context, {
  2. bool useScaffold = true,
})

Implementation

static OpenMenu<T> of<T>(BuildContext context, {bool useScaffold = true}) {
  final layoutInfo = sunny.get<LayoutInfo>(context: context);
  final OpenMenu<T>? override = _menuHandlers
      .map((e) => e<T>(context))
      .firstWhere((element) => element != null, orElse: () => null);
  if (override != null) {
    return override;
  }
  if (layoutInfo.screenType == DeviceScreenType.desktop) {
    return openDesktopMenu<T>;
  } else if (infoX.isAndroid) {
    return openAndroidMenu<T>;
  } else if (useScaffold && infoX.isIOS) {
    return cupertinoMenuOpener<T>(useScaffold: useScaffold);
  } else if (infoX.isIOS) {
    return cupertinoMenuOpener<T>(useScaffold: false);
  } else {
    return openAndroidMenu<T>;
  }
}