getDeviceWidget static method

Widget getDeviceWidget({
  1. BuildContext? context,
  2. required Widget defaultWidget,
  3. Widget? desktopWidget,
  4. Widget? mobileWidget,
})

Implementation

static Widget getDeviceWidget({
  /// Although specifying the `BuildContext` is optional, providing it can prevent layout issues when this widget renders immediately after the app launch.
  /// If this widget needs to be used at the moment the app launches, it's recommended to provide the `BuildContext` here.
  BuildContext? context,
  required Widget defaultWidget,
  Widget? desktopWidget,
  Widget? mobileWidget,
}) {
  deviceType ??= getFormFactor(context);
  if (deviceType == DeviceType.Desktop) return desktopWidget ?? defaultWidget;
  return mobileWidget ?? defaultWidget;
}