getDeviceWidget static method
Widget
getDeviceWidget({
- BuildContext? context,
- required Widget defaultWidget,
- Widget? desktopWidget,
- 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;
}