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

Wrongly identifies phone as tablet from Samsung A71 #16

Open
b099l3 opened this issue Feb 17, 2022 · 0 comments
Open

Wrongly identifies phone as tablet from Samsung A71 #16

b099l3 opened this issue Feb 17, 2022 · 0 comments

Comments

@b099l3
Copy link

b099l3 commented Feb 17, 2022

This package thinks the Samsung A71 and other long android devices are tablets:

Samsung A71 Spec:
1080 x 2400 pixels
6.7 inches

Result from Device.get():

Device
  hasNotch:true
  isAndroid:true
  isIos:false
  isIphoneX:false
  isPhone:false
  isTablet:true

Result from

Device.devicePixelRatio
2.325000047683716

Device.size
Size (Size(1080.0, 2400.0))

Device.height
2400.0

Device.width
1080.0

I wonder if it is todo with this code in flutter_device_type.dart L64:

// Recalculate for Android Tablet using device inches
    if (isAndroid) {
      final adjustedWidth = _calWidth() / devicePixelRatio;
      final adjustedHeight = _calHeight() / devicePixelRatio;
      final diagonalSizeInches = (Math.sqrt(
              Math.pow(adjustedWidth, 2) + Math.pow(adjustedHeight, 2))) /
          _ppi;
      //print("Dialog size inches is $diagonalSizeInches");
      if (diagonalSizeInches >= 7) { // <- It must think it is over 7 inches
        isTablet = true;
        isPhone = false;
      } else {
        isTablet = false;
        isPhone = true;
      }
    }
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