Skip to content

Instantly share code, notes, and snippets.

@Alii-isk
Created January 29, 2023 19:52
Show Gist options
  • Save Alii-isk/565e782d17e8f882cd9822eddb470f5f to your computer and use it in GitHub Desktop.
Save Alii-isk/565e782d17e8f882cd9822eddb470f5f to your computer and use it in GitHub Desktop.
flutter LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES
/* ----------------------------------------------------------------------- */
/* 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