of<T> static method

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

Implementation

static ModalOpener of<T>(BuildContext context, {bool useScaffold = true}) {
  final layoutInfo = sunny.get<LayoutInfo>(context: context);
  final ModalOpener? override = _modalHandlers
      .map((e) => e(context, useScaffold: useScaffold))
      .firstWhere((element) => element != null, orElse: () => null);
  if (override != null) {
    return override;
  }
  if (layoutInfo.screenType == DeviceScreenType.desktop) {
    return desktop;
  } else if (infoX.isAndroid) {
    return android;
  } else if (useScaffold && infoX.isIOS) {
    return cupertino;
  } else if (infoX.isIOS) {
    return cupertinoNoScaffold;
  } else {
    return android;
  }
}