edge_to_edge_system_ui 0.1.0-dev.2
edge_to_edge_system_ui: ^0.1.0-dev.2 copied to clipboard
Flutter plugin providing an opinionated Edge-to-Edge system UI controller with a Kotlin implementation for Android.
edge_to_edge_system_ui #
A small Flutter plugin that exposes an Android Kotlin implementation to control edge-to-edge system UI (status/navigation bars) and surface insets. Designed as a lightweight plugin suitable for inclusion on pub.dev.
Features
- Query system inset sizes and whether edge-to-edge mode is enabled
- Enable/disable edge-to-edge at runtime
- Apply status/navigation bar colors and icon brightness
Usage
- Add the plugin to your pubspec (local or on pub.dev)
- Call
EdgeToEdgeSystemUIKotlin.instance.initialize()on app startup - Use
getSystemInfo(),enableEdgeToEdge(),disableEdgeToEdge()andsetSystemUIStyle(...)as needed.
Example code is included in the example/ folder.
Quick start #
Add the package to pubspec.yaml (when published):
dependencies:
edge_to_edge_system_ui: ^0.1.0
Initialize and query system info:
await EdgeToEdgeSystemUIKotlin.instance.initialize();
final info = await EdgeToEdgeSystemUIKotlin.instance.getSystemInfo();
print('Navigation bar height: ${info.navigationBarsHeight} dp');
See example/ for a runnable demo.
Publishing
- Update
publish_toinpubspec.yamlto point tohttps://pub.dev. - Run
flutter pub publish --dry-runandflutter pub publishwhen ready.
Notes
- The plugin only implements Android in Kotlin currently. iOS and other platforms are no-ops.
- The plugin returns inset sizes in logical pixels (dp) to match Flutter's
MediaQuery.
Changelog #
See CHANGELOG.md for recent changes and version history.
Optional Debugging Flag #
During development, you may want to prevent the screen from turning off. Add the following code to your MainActivity:
val isDebuggable = (application?.applicationInfo?.flags ?: 0) and
android.content.pm.ApplicationInfo.FLAG_DEBUGGABLE != 0
if (isDebuggable) {
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
}
This ensures the screen stays on while the app is running in debug mode.
AndroidManifest Configuration #
To ensure proper edge-to-edge functionality and compatibility with Android 13+ features, you may need to update your AndroidManifest.xml file.
-
Edge-to-Edge Enforcement (Android 13+): Add the following attribute to the
<application>tag to ensure edge-to-edge behavior is enforced:android:windowOptOutEdgeToEdgeEnforcement="false" -
Back Navigation Compatibility (Android 13+): Add the following attribute to the
<application>tag to enable the new back navigation behavior:android:enableOnBackInvokedCallback="true" -
Optional Permission for System Overlays: If your app requires system-level overlays (e.g., floating windows), add the following permission before the
<application>tag:<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
These configurations are optional but recommended for apps targeting Android 13+ to ensure consistent behavior and compatibility.