identifying screen cutout position in flutter

606 Views Asked by At

My app has a search bar in its top area. There are devices with special cutouts. in order to expand the app to real full screen, I Added to <app_name>\android\app\src\main\AndroidManifest.xml:

<style name="ActivityTheme">
  <item name="android:windowLayoutInDisplayCutoutMode">
    shortEdges
  </item>
</style>

That works fine. However, the obvious next step is to recognize cutout position, and place the search bar accordingly:

cutout options

The mentioned documentation refers to a JAVA method WindowInsets.getDisplayCutout(). I wonder if there is an equivalent in flutter or a plugin which wraps it.

1

There are 1 best solutions below

0
On

There is a SafeArea widget that will add insets so that you can avoid device. I'd give this a try - I know it works with common features like the iphone top cutout and the android camera.