FilledStacks / responsive_builder

A set of widgets to make responsive UI building in flutter more readable
MIT License
503 stars 81 forks source link

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

Open Trung15010802 opened 11 months ago

Trung15010802 commented 11 months ago

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 commented 11 months ago

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 commented 11 months ago

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

https://github.com/FilledStacks/responsive_builder/assets/90593296/63d07e6f-b4c8-4ccc-98c4-010b19ff5a66

Trung15010802 commented 11 months ago

Hi @FilledStacks ,any update ?