Created
January 29, 2023 19:52
-
-
Save Alii-isk/565e782d17e8f882cd9822eddb470f5f to your computer and use it in GitHub Desktop.
flutter LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* ----------------------------------------------------------------------- */ | |
/* ENABLE CUTOUT MODE FOR ANDROID 9.0 AND ABOVE DEVICES */ | |
/* to avoid notch cutout and black bars on the sides issue in flutter */ | |
/* ----------------------------------------------------------------------- */ | |
import android.os.Build | |
import android.view.WindowManager | |
import io.flutter.embedding.android.FlutterActivity | |
class MainActivity: FlutterActivity(){ | |
override fun onCreate(savedInstanceState: android.os.Bundle?) { | |
super.onCreate(savedInstanceState) | |
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { | |
window.attributes.layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES; | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment