Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code on iOS Tablet Simulator returns a wrong type #60

Open
MichalDanielDobrzanski opened this issue Jul 15, 2024 · 1 comment
Open

Code on iOS Tablet Simulator returns a wrong type #60

MichalDanielDobrzanski opened this issue Jul 15, 2024 · 1 comment

Comments

@MichalDanielDobrzanski
Copy link

I create a Simulator device - iPad Pro 13-inch (M4) 17.4.

When I am using ResponsiveBuilder, deviceScreenType reports DeviceScreenType.desktop.

Expected scenario: deviceScreenType should report DeviceScreenType.tablet.

@MichalDanielDobrzanski
Copy link
Author

For the reference - I used the following fix to handle my emulator case.

             DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
                  if (Platform.isIOS) {
                    return FutureBuilder(
                      future: deviceInfo.iosInfo,
                      builder: (_, snapshot) {
                        if (!snapshot.hasData) return const SizedBox();
                        var iosInfo = snapshot.data!;
                        bool isSimulator = !iosInfo.isPhysicalDevice;
                        bool isTablet =
                            iosInfo.model.toLowerCase().contains('ipad');
                        if (isSimulator && isTablet) {
                          // a fix for a library
                          return _renderTabletWidget();
                        } else if (sizingInformation.isTablet) {
                          return _renderTabletWidget();
                        } else {
                          return _renderWidget();
                        }
                      },
                    );
                  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant