Created
April 15, 2021 16:48
-
-
Save fredgrott/a0674dc2d96e9af9f190e567390d61fd to your computer and use it in GitHub Desktop.
full screen work-arounds for android using flutter native kotlin
This file contains hidden or 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
import android.os.Build | |
import android.view.WindowManager | |
import androidx.core.view.WindowCompat | |
import io.flutter.embedding.android.FlutterActivity | |
class MainActivity: FlutterActivity() { | |
override fun onPostResume() { | |
super.onPostResume() | |
// to handle case of the bottom sys navbar | |
if(Build.VERSION.SDK_INT>= Build.VERSION_CODES.O_MR1){ | |
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) | |
window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION) | |
} | |
// fixes edge to edge on 30 and beyond only | |
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { | |
WindowCompat.setDecorFitsSystemWindows(window, false) | |
window.navigationBarColor = 0 | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment