Skip to content

Commit

Permalink
Enables edge to edge support in material 3 demo.
Browse files Browse the repository at this point in the history
Edge to edge is coming by default to Flutter 3.26+ or so when the targetSdk is raised to Android 15(API 35). In the meantime, it can be done manually by adjusting the theme and setting `WindowCompat.setDecorFitsSystemWindows`.

Fixes #1720 .
  • Loading branch information
jwill committed Sep 19, 2024
1 parent cdd2a42 commit 22cc746
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
package com.example.material_3_demo

import io.flutter.embedding.android.FlutterActivity
import android.os.Bundle
import androidx.core.view.WindowCompat

class MainActivity: FlutterActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
WindowCompat.setDecorFitsSystemWindows(window, false)
}

}
14 changes: 14 additions & 0 deletions material_3_demo/android/app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,19 @@
This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
<!-- values-v29/themes.xml -->
<item name="android:navigationBarColor">
@android:color/transparent
</item>

<!-- Optional: set to transparent if your app is drawing behind the status bar. -->
<item name="android:statusBarColor">
@android:color/transparent
</item>

<!-- Optional: set for a light status bar with dark content. -->
<item name="android:windowLightStatusBar">
true
</item>
</style>
</resources>

0 comments on commit 22cc746

Please sign in to comment.