Solve the problem that the status bar of the Flutter rotating screen is blank

question

Recently, I want to implement a video player. When playing in full screen, the screen needs to be rotated. I took out the case and tried it. After rotating the screen, the state is as follows
The left side presents a black void due to the perforated screen.

Solution

Open the project android/app/src/main/res/values/styles.xml

Add to<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
        <item name="android:windowBackground">@drawable/launch_background</item>
    </style>
    <style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
        <item name="android:windowBackground">?android:colorBackground</item>
        <item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
    </style>
</resources>```

The startup page configuration is under LaunchTheme, and the normal page configuration is under NormalTheme

After solving

The gap in the status bar disappears
insert image description here

Summarize

I haven't done a native project before using flutter, and I don't know many configurations, OK!

Guess you like

Origin blog.csdn.net/weixin_44354735/article/details/126656201