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

[FLUTTER WEB] Cannot detect landscape mode on mobile. #57

Open
Trung15010802 opened this issue Nov 21, 2023 · 3 comments
Open

[FLUTTER WEB] Cannot detect landscape mode on mobile. #57

Trung15010802 opened this issue Nov 21, 2023 · 3 comments

Comments

@Trung15010802
Copy link

Trung15010802 commented Nov 21, 2023

I have read the docs about your package. I decided using it for my website. But one thing i wanna know.
Is this package can detect phone or tablet screen but in landscape mode. Thank you very much

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(widget.title),
      ),
      body: ScreenTypeLayout.builder(
        mobile: (BuildContext context) => OrientationLayoutBuilder(
          portrait: (context) => Container(color: Colors.green),
          landscape: (context) => Container(color: Colors.orange),
        ),
        tablet: (BuildContext context) => Container(color: Colors.yellow),
        desktop: (BuildContext context) => Container(color: Colors.red),
        watch: (BuildContext context) => Container(color: Colors.purple),
      ),
    );
  }
}

I tried this code above but it's not working as my expectation

image
I think it should be orange

@FilledStacks
Copy link
Owner

Orientation doesn't use the resolution, it uses the shortest side, which on a real device is updated based on the actual oritentation of the device.

Can you run on a mobile device, swap the orientation and check.

@Trung15010802
Copy link
Author

Trung15010802 commented Nov 29, 2023

Orientation doesn't use the resolution, it uses the shortest side, which on a real device is updated based on the actual oritentation of the device.

Can you run on a mobile device, swap the orientation and check.

I have run on a real mobile device (Xiaomi k30) and it still doesn't work as my expectation (orange not yellow): This is a BUG on Flutter WEB

3355122390263323361.mp4

@Trung15010802 Trung15010802 changed the title Is this package can check phone, tablet is landscape [FLUTTER WEB] Cannot detect landscape mode on mobile. Nov 29, 2023
@Trung15010802
Copy link
Author

Trung15010802 commented Dec 7, 2023

Hi @FilledStacks ,any update ?

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

2 participants