responsive_builder icon indicating copy to clipboard operation
responsive_builder copied to clipboard

[FLUTTER WEB] Cannot detect landscape mode on mobile.

Open Trung15010802 opened this issue 1 year ago • 3 comments

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

Trung15010802 avatar Nov 21 '23 09:11 Trung15010802

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.

FilledStacks avatar Nov 28 '23 09:11 FilledStacks

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 avatar Nov 29 '23 03:11 Trung15010802

Hi @FilledStacks ,any update ?

Trung15010802 avatar Dec 07 '23 01:12 Trung15010802