FilledStacks / responsive_builder

A set of widgets to make responsive UI building in flutter more readable

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[FLUTTER WEB] Cannot detect landscape mode on mobile.

Trung15010802 opened this issue · 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

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.

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

Hi @FilledStacks ,any update ?