team113 / messenger

Open-source front-end part of messenger by team113
GNU Affero General Public License v3.0
14 stars 13 forks source link

`SafeArea` doesn't work in PWAs #1015

Open SleepySquash opened 1 month ago

SleepySquash commented 1 month ago

Summary

When web application is installed as a PWA, SafeAreas always return EdgeInsets.zero, meaning no paddings are added anywhere in the application. This causes overlapping issues, for example, with phones having some kind of notches or bottom navigation over screen.

Steps to reproduce

  1. Build and deploy (e.g. with dhttpd) web application.
  2. Launch it from a mobile device that has a notch or gesture-like bottom navigation.
  3. Add the application to home screen as a PWA.
  4. Launch PWA and notice all SafeAreas missing its paddings.

What is the current bug behavior?

SafeArea doesn't work in PWAs.

What is the expected correct behavior?

SafeArea correctly adds paddings of the screen insets.

Possible fixes

This should be fixed by the Flutter framework, however I can suggest the following workaround: perhaps we may create some kind of div element or use a JavaScript method to retrieve the paddings from the HTML window and then apply those paddings?